Question

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?

Was it helpful?

Solution 4

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.

OTHER TIPS

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

hg commit -m "message"

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.

For me, the problem was that git was not on my system path. Adding it allowed me to commit my git subrepository (note that I had to restart TortoiseHg workbench for it to get the updated system path).

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.

When I had this issue, the problem was that I had two slashes in the path to the subrepo directory.

If there is a case difference between the folder name for the subrepo and it's path in the .hgsub file this will also trigger this error message.

I experienced this by copying an .hgsub from another repo that had the same folder structure however the new repo used title casing for the folder names while the folders in the original repo were all lower case.

Changing either the .hgsub or the folder names themselves solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top