Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: Subrepo error -- "abort: commit with new subrepo [path] excluded"

I'm trying to setup the subrepositories in my Mercurial project repo for the project's dependencies. But when I try to commit the .hgsub file I keep getting this error:

abort: commit with new subrepo lib/dependency-dir excluded

Details:

Inside my project's Mercurial repository directory (at the top level), I have a subdirectory, lib/, which will contain my dependencies.

It just so happens that all my dependencies live on github, where I've forked each library to create, e.g., https://github.com/mygithubaccount/forked-dependency

I created an .hgsub file and added it to the repository (also at the top level). It contains entries like the following (I've tried isolating each one individually as follows; it doesn't seem to make any difference):

lib/dependency-dir = [git]https://github.com/mygithubaccount/forked-dependency.git

Then I did the following, starting in my project repository's working directory:

$ cd lib
$ git clone https://github.com/mygithubaccount/forked-dependency.git dependency-dir
$ cd ..
$ hg commit .hgsub
abort: commit with new subrepo lib/dependency-dir excluded

Any ideas what I'm doing wrong?

like image 611
Brian Lacy Avatar asked May 28 '13 20:05

Brian Lacy


5 Answers

The only way I got this work was to commit without specifying the .hgsub file

hg commit -m "message"

like image 138
simianarmy Avatar answered Oct 18 '22 09:10

simianarmy


I found your question when I had the same problem. I used TortoiseHG and it gave me the same error. Solutions here, were useless for me, but I found the answer.

In my case the problem was in the HG version: I found that my TortoiseHG uses hg ver. 2.5. When I use hg ver 3.9 .hgsub commited correctly.

P.S. I Understand that my answer does not help you, but I hope it will help other people like me.

like image 44
Fill Freeman Avatar answered Oct 06 '22 20:10

Fill Freeman


I just fixed the problem by adding the file first, and then committing:

$ hg add .hgsub
...
$ hg commit .hgsub
like image 3
Mathieu Longtin Avatar answered Oct 18 '22 09:10

Mathieu Longtin


I had to commit both .hgsub and the new subrepository at the same time by explicitly selecting them in the commit command. I avoided hg commit all because I had other files that contained work in progress.

like image 3
Steinin Avatar answered Oct 18 '22 08:10

Steinin


I had this issue too. I'm not sure if it matches your situation, but I was trying to add subrepositories to a new repo. Once I added other files and commited them I was then able to add the .hgsub file with the subrepos and commit it without getting this error.

like image 2
Carl Avatar answered Oct 18 '22 08:10

Carl