Problem using subrepos

eric.m.lafrance at ca.abb.com eric.m.lafrance at ca.abb.com
Wed Jun 1 13:20:13 CDT 2011


Mads,

Thanks for your answer. Here's some more details on the things you have 
raised.

Mads Kiilerich wrote:
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.

I tried using relative paths at first, and it failed, so I tried with 
absolute paths to make sure my relative paths were not the cause of my 
problem. I should have reverted to the relative paths though.

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

I assumed that I'd also get the .hgsubstate file from "proj", which would 
point to the correct revision of lib for this project. This is correct, 
right? 

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

Yes, this would be the result I expect in this case. If I modify a library 
from a local clone of a projet, I would expect the main source (proj) to 
be updated to use the correct revision of the library. I would also expect 
that other projects refering to the same library would not be affected by 
this new change, unless they specifically pull those changes into their 
project. This is all correct? 

Mads Kiilerich wrote:
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.

I get the same error message whether I use relative paths or not. I do 
agree with you though, this doesn't seem to make any sense, at least to 
me. 

Mads Kiilerich wrote:
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.

I manually checked after having run my script, and "lib" was in the 
correct state, with the new change being present and available. Manually 
pulling the changes from "proj/lib" worked fine too. Additionally, the 
.hgsubstate seems to be updated correctly when I run the hg update command 
on "proj" (i.e. I can see that the revision it refers to is being updated 
with the new "lib" revision, even though I get the error message I 
described earlier). 

Someone (Ry4an) was kind enough to translate my batch into a bash script, 
and tested it. Turns out that it worked perfectly. So I believe that what 
I'm trying to do here is supposed to work the way I'm doing it, but 
somehow there is a path problem lurking in somewhere, which only affect 
Windows. 

I have attached some new files related to this problem: 

- testsubrepo.txt: My updated test batch file, with relative paths and 
forward slashes instead of backslashes, and more debug info when I update 
"proj" at line 68.
- errorMessageUpdate.txt: The error message when I run "call hg --debug 
--traceback update" in my test script, at line 68 
- Bash script subrepos.txt: Ry4an's bash equivalent of my batch file. This 
one works.

If there is some more things you'd like to see, I'll try to generate them.





Eric Lafrance





Mads Kiilerich <mads at kiilerich.com> 
05/31/2011 07:06 PM

To
Eric M Lafrance/CAABB/ABB at ABB_CAABB
cc
mercurial at selenic.com
Subject
Re: Problem using subrepos






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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20110601/4a027889/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testsubrepo.txt
URL: <http://selenic.com/pipermail/mercurial/attachments/20110601/4a027889/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: errorMessageUpdate.txt
URL: <http://selenic.com/pipermail/mercurial/attachments/20110601/4a027889/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Bash script subrepos.txt
URL: <http://selenic.com/pipermail/mercurial/attachments/20110601/4a027889/attachment-0002.txt>


More information about the Mercurial mailing list