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?
The only way I got this work was to commit without specifying the .hgsub file
hg commit -m "message"
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.
I just fixed the problem by adding the file first, and then committing:
$ hg add .hgsub
...
$ hg commit .hgsub
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With