Problem using subrepos

Mads Kiilerich mads at kiilerich.com
Tue May 31 23:06:23 UTC 2011


lafou wrote, On 05/31/2011 05:56 PM:
> I am trying to use subrepos to manage my projects, but I observed some
> strange things, and I need some help to sort them out. I ran a few seaches,
> but couldn't find anything related to my problem (or at least I don't think
> they were). I am running Mercurial 1.8.3 under Windows XP SP3 (I observed
> the same behavior with version 1.8.0).
>
> On my local disk, I have 3 repositories:
>
> * lib -->  A library I want to use in different projects
> * proj -->  A project that will use "lib" as a subrepo
> * projlocal -->  A clone of "proj"
>
> I cloned "lib" into "proj", and it worked fine (also created the .hgsub file
> with the subrepo information).

I can see in your script that you use a "non-trivial" subrepo mapping 
"lib=d:\temp\lib". That is in my opinion always a bad idea, and I guess 
that is what is causing your problems.

> Then I cloned "proj" into "projlocal",

Note that you thus don't get projlocal\lib from proj\lib but from 
d:\temp\lib. I doubt that is what you want.

> made a
> modification to a file in "lib", then committed/pushed my changes,

So your new lib revisions ends up in d:\temp\lib and it is now 
referenced from proj

> which
> worked fine too. I also went into "lib" and ran "hg update" to make sure the
> changes were available.
>
> However, if I go in the "proj" repository and try to run "hg update", the
> first time it fails with the message "abort: default path for subrepository
> lib not found".

Really? That message would make sense if you had a non-trivial relative 
subrepo mapping, such as "lib=..\..\..\lib" but it shouldn't appear whn 
you use absolute paths.

> If I run the update a second time, the message changes to
> "abort: unknown revision '132c97c71be87d5407a8c4ad606c8e58b4d86d0a'!"

That means that your repositories are inconsistent. A revision of .hgsub 
has been pushed/pulled to proj, but the corresponding revision has 
neither been pushed to proj\lib nor to d:\temp\lib. Mercurial can thus 
not find and restore the requested revision.

> If I run "hg pull -u" in the subrepo first, then run "hg update" in "proj",
> I don't get those error messages. However, my .hgsubstate file is tagged as
> being modified after I have performed those 2 commands, which I find weird.

This doesn't match the rest of your description. Please include it in 
your test script and show us.

> I have attached the batch file I use to perform those actions. I'd like to
> know what I'm doing wrong here. Thanks.
> http://mercurial.808500.n3.nabble.com/file/n3006641/testsubrepo.bat
> testsubrepo.bat

Oh - nabble is evil and scrubbing attachments. Mailing lists works best 
with mails ;-)

I can't reproduce with your script when translating it to unix and it 
doesn't completely match your description. Can you show us the output 
from your script - preferably with "echo on" so the commands and their 
output is interleaved?

/Mads




More information about the Mercurial mailing list