I'm trying to set up my Mercurial repository system to work with multiple subrepos. I've basically followed these instructions to set up the client repo with Mercurial client v1.5 and I'm using HgWebDir to host my multiple projects.
I have an HgWebDir with the following structure:
http://myserver/hg
|-- fooproj
|-- mylib
where mylib
is some collection of common template library to be consumed by fooproj
. The structure of fooproj
looks like this:
fooproj
|-- doc/
| `-- readme
|-- src/
| `-- main.cpp
|-- .hgignore
|-- .hgsub
`-- .hgsubstate
And .hgsub
looks like:
src/mylib = http://myserver/hg/mylib
This should work, per my interpretation of the documentation:
The first 'nested' is the path in our working dir, and the second is a URL or path to pull from.
Also, the mylib
project directory structure looks like this:
mylib
|-- .hg
| |-- 00changelog.i
| |-- dirstate
| |-- requires
| |-- store
| | |-- 00changelog.i
| | |-- 00manifest.i
| | | |-- data
| | | | ` magic.h.i
| | |-- fncache
| | `-- undo
| |-- undo.branch
| `-- undo.dirstate
`-- magic.h
So, let's say I pull down fooproj
to my home folder with:
~$ hg clone http://myserver/hg/fooproj foo
Which pulls down the directory structure properly and adds the folder ~/foo/src/mylib
which is a local Mercurial repository. This is where the problems begin: the mylib
folder is empty aside from the items in .hg
. The messages from Mercurial are:
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 5 changes to 5 files
updating working directory
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
With 2 seconds of investigation, one can see the src/mylib/.hg/hgrc
is:
[paths]
default = http://myserver/hg/fooproj/src/mylib
which is completely wrong (attempting a pull
of that repo will give a 404 because, well, that URL doesn't make any sense).
foo
|-- .hg
| |-- 00changelog.i
| |-- branch
| |-- branchheads.cache
| |-- dirstate
| |-- hgrc
| |-- requires
| |-- store
| | |-- 00changelog.i
| | |-- 00manifest.i
| | |-- data
| | | |-- .hgignore.i
| | | |-- .hgsub.i
| | | |-- .hgsubstate.i
| | | |-- doc
| | | | `-- readme.i
| | | `-- src
| | | `-- main.cpp.i
| | |-- fncache
| | `-- undo
| |-- tags.cache
| |-- undo.branch
| `-- undo.dirstate
|-- .hgignore
|-- .hgsub
|-- .hgsubstate
|-- doc
| `-- readme
`-- src
|-- main.cpp
`-- mylib
`-- .hg
|-- 00changelog.i
|-- branch
|-- dirstate
|-- hgrc
|-- requires
`-- store
Logically, the default value should be what I specified in .hgsub
or it would get the files from the repository in some way. Of course, changing src/mylib/.hg/hgrc
to:
[paths]
default = http://myserver/hg/mylib
and running hg pull && hg update
works perfectly. Of course, this is basically the same thing as not using subrepos in the first place.
None of the Mercurial commands return error codes (aside from a pull
from within src/mylib
), so it clearly believes that it is behaving properly (and just might be), although this does not seem logical at all.
What am I doing wrong?
The ultimate problem might be that .hgsubstate
will always look like:
0000000000000000000000000000000000000000 src/mylib
But I have no idea how to fix that...