Problem using subrepos
Mads Kiilerich
mads at kiilerich.com
Thu Jun 2 08:25:01 CDT 2011
Eric M Lafrance wrote, On 06/01/2011 10:07 PM:
>
> Mads,
>
> "BatchFileOutput.txt" contains the output of each significant command
> in my test batch file.
> D:\Temp>rmdir /s /q lib
>
> D:\Temp>rmdir /s /q proj
>
> D:\Temp>rmdir /s /q projlocal
>
> D:\Temp>hg init lib
>
> D:\Temp>hg init proj
Init doesn't create proj\.hg\hgrc.
> D:\Temp>echo main project data> proj\proj.txt
>
> D:\Temp>echo this is a lib file> lib\lib.txt
>
> D:\Temp>cd lib
>
> D:\Temp\lib>hg add
> adding lib.txt
>
> D:\Temp\lib>hg commit -m "Added first lib file"
>
> D:\Temp\lib>cd..
>
> D:\Temp>cd proj
>
> D:\Temp\proj>hg clone ../lib
> destination directory: lib
> updating to branch default
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Note that this means that proj\lib\.hg\hgrc has [paths] default=d:\Temp\lib
>
> D:\Temp\proj>echo lib=../lib > .hgsub
In the previous example you used an absolute path. But ok, now we do it
this way ...
>
> D:\Temp\proj>hg add
> adding .hgsub
> adding proj.txt
>
> D:\Temp\proj>hg commit -m "Incorporated lib into proj"
> committing subrepository lib
>
> D:\Temp\proj>cd..
>
> D:\Temp>hg clone proj projlocal
> updating to branch default
> pulling subrepo lib from D:\Temp\proj\../lib
> requesting all changes
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
> 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> D:\Temp>cd projlocal\lib
>
> D:\Temp\projlocal\lib>echo New line added from projlocal>>lib.txt
>
> D:\Temp\projlocal\lib>cd..
>
> D:\Temp\projlocal>hg commit -m "Added a line in lib from projlocal"
> committing subrepository lib
>
> D:\Temp\projlocal>hg push
> pushing to d:\Temp\proj
> pushing subrepo lib to D:\Temp\proj\../lib
Temp\proj\.hgsubstate now references a change that only exists in Temp\lib .
> searching for changes
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
> searching for changes
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
>
> D:\Temp\projlocal>cd ..\lib
>
> D:\Temp\lib>hg update
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> D:\Temp\lib>cd..
>
> D:\Temp>cd proj
>
> D:\Temp\proj>hg --debug --traceback update
> searching for copies back to rev 1
> resolving manifests
> overwrite False partial False
> ancestor 3dad70aa1d0f local 3dad70aa1d0f+ remote 13536ab74c75
> .hgsubstate: remote is newer -> g
> updating: .hgsubstate 1/1 files (100.00%)
> getting .hgsubstate
> subrepo merge 3dad70aa1d0f+ 13536ab74c75 3dad70aa1d0f+
> subrepo lib: other changed, get
> ../lib:829e726c428f48bffd5004ad83b971d7341ee07
> 2:hg
> Traceback (most recent call last):
> File "mercurial\dispatch.pyc", line 58, in _runcatch
> File "mercurial\dispatch.pyc", line 601, in _dispatch
> File "mercurial\dispatch.pyc", line 406, in runcommand
> File "mercurial\dispatch.pyc", line 655, in _runcommand
> File "mercurial\dispatch.pyc", line 609, in checkargs
> File "mercurial\dispatch.pyc", line 598, in <lambda>
> File "mercurial\util.pyc", line 433, in check
> File "mercurial\commands.pyc", line 4080, in update
> File "mercurial\hg.pyc", line 381, in update
> File "mercurial\merge.pyc", line 549, in update
> File "mercurial\merge.pyc", line 353, in applyupdates
> File "mercurial\subrepo.pyc", line 118, in submerge
> File "mercurial\subrepo.pyc", line 451, in get
> File "mercurial\subrepo.pyc", line 444, in _get
> File "mercurial\subrepo.pyc", line 225, in _abssource
> Abort: default path for subrepository lib not found
> abort: default path for subrepository lib not found
Yes, that is what Mercurial has to say.
proj\.hgsubstate says that proj\lib should be updated to a revision
unknown to proj\lib. Mercurial tries to pull the revision from
"somewhere". proj\lib is used as a subrepository so it doesn't use the
default path that might be (an is) set in proj\lib's hgrc. Instead it
obeys that you said that its default path was ..\lib and thus relative
to the outer repos (default) pull path. The outer repo do however not
have any default path - that is what it is trying to tell you.
Obviously, if you had used an absolute path in .hgsub it would have used
that without caring about the outer repos default path.
The abort message you could be improved to say "pull path for
subrepository lib not found", but I don't know how much that would have
helped you.
>
> "PullingLibBeforeUpdate.txt" shows the output when I run "hg pull -u"
> in "proj/lib" before updating "proj" (line 68 in my test batch file).
Yes, then proj\lib isn't used as subrepo but as a repo by itself and
then it uses its own default path from proj\lib\.hg\hgrc and gets the
missing changeset from temp\lib.
"Doctor, doctor, it hurts when I use subrepos with non-trivial mappings".
"Well, then don't do that!"
(Ok, other mappings than trivial relative x=x mappings can work just
fine if Mercurial is used in a 100% centralized model without any
distributed cloning or pulling - but then why use Mercurial?)
/Mads
More information about the Mercurial
mailing list