mercurialsubrepos

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?


Solution

  • 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.