Subrepo behavior doesn't seem to match documentation
Pradeepkumar Gayam
in3xes at gmail.com
Mon Jul 12 16:32:19 UTC 2010
-- Pradeep
On Mon, Jul 12, 2010 at 9:13 PM, James Hill <jshill4 at cs.wisc.edu> wrote:
> Given the repository below these are the exact commands I run from the top
> level directory.
>
> You are not doing anything wrong. This the a know issue. Wiki says 'hg
pull' doesn't recursively pull changes from subrepos. If you 'hg update' it
recursively update all the subrepos to the revision given in .hgsubstate
file.
Let's say at this moment your .hgsubstate file contains
a is at version x
b is at version y
cd a
> echo "change to foo" >> foo
> hg commit -m "changed foo"
>
> after commit .hgsubstate contains
a is at version x
b is at version y
Cause you didn't commit in main, so it doesn't know you subrepo is changed.
cd ../main
> hg update
>
> when you update, mercurial looks in .hgsubstate and finds a is at revision
x. So it tries to update to revision x. but 'a' is already at revision x. so
it does nothing. resulting your output.
the output is:
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> editing a/foo showes no changes. If I cd into a and run "hg pull" it gets
> the change which makes sense because it was cloned from a but this doesn't
> work in a clone, I get the message.
>
> pulling from /afs/
> cs.wisc.edu/u/j/s/jshill4/Experimental/hgtest/basictest/main/a
> searching for changes
> no changes found
>
> This is a know issue, pull from clone is not supported. aths doesn't
propagates to subrepo from last pull. This is also listed in wiki.
which is pulling from main's version of a. I don't understand this,
> shouldn't it be pulling from the repository listed in .hgsub, should it have
> been cloned from there in the first place?
>
> What am I doing wrong?
>
> my .hgsub file is as follows
>
> a = [hg]/u/j/s/jshill4/Experimental/hgtest/basictest/a
> b = [hg]/u/j/s/jshill4/Experimental/hgtest/basictest/b
>
> do you see any problems there?
>
> Thanks,
>
> - Jim
>
>
> Pradeepkumar Gayam wrote:
>
>>
>> -- Pradeep
>>
>>
>>
>> On Mon, Jul 12, 2010 at 8:35 PM, jshill4 <jshill4 at cs.wisc.edu <mailto:
>> jshill4 at cs.wisc.edu>> wrote:
>>
>>
>> Hi, I'm currently working on switching our labs repo system to
>> mercurial from
>> CVS. One of the things we need is the ability to checkout specific
>> modules
>> depending on the project that is checked out. Subrepos in mercurial
>> seems
>> to do this but one piece doesn't work like I thought it would.
>>
>> Say I have this basic directory structure.
>>
>> ./a
>> foo
>> ./b
>> bar
>> ./main
>> a
>> b
>> .hgsub
>> .hgsubstate
>> ./main-clone
>> a
>> b
>> .hgsub
>> .hgsubstate
>>
>> a and b are both library mercurial modules that we may want to
>> include in
>> several projects, they have files foo and bar in them. main is a
>> project
>> that has a and b as subrepositories along with .hgsub and
>> .hgsubstate which
>> are required. main-clone is a clone of main which gets a, b, and the
>> subrepo files.
>>
>> My problem is in version 1.5. I remember it working in 1.3. If I
>> clone
>> "a", make a change to foo in the clone, push that change back to "a"
>> and
>> then attempt an update from main-clone, it claims that there are no
>> updates
>> and does not change the updated foo file under a under main-clone.
>>
>> There's a reason why it doesn't work. when you pull from main repo it
>> doesn't recursively pull all the changes from subrepos. But when you update
>> from main repo it pulls recursively from subrepos.
>>
>> This seems like broken functionality. From the section on updating
>> from the
>> mercurial subrepo page:
>>
>> "Whenever newer Mercurial versions encounter this .hgsubstate file when
>> updating your working directory, they'll attempt to pull the specified
>> subrepos and update them to the appropriate state"
>>
>> I read that as: if there is a .hgsubstate file in the current
>> repositor hg
>> will enter each subrepo directory (as listed in .hgsubstate) and
>> attempt to
>> pull any updates from the original repository listed in .hgsub/
>>
>> In this case it doesn't work even if you 'hg update' from main repo.
>> Because when you update from main repo it reads status of subrepos from
>> .hgsubstatus and tries to update to the new status. But nothing actually
>> changed in main because you didn't commit in main.So effectively it doesn't
>> pull anything to main to main-clone. when you update, subrepos are already
>> updated as indicated in .hgsubstate. so it doesn't try to pull. Hence your
>> problem. You can pull changes from main-clone/a.
>>
>> I may not fully understand the purpose of subrepos but I would think
>> this
>> would be a requirement, if someone randomly modifies one of the
>> libraries my
>> project depends on, I want hg to automatically pull that change if the
>> module is a subrepository in my project.
>>
>> Any help understanding this problem would be greatly appreciated and,
>> if
>> it's needed, I can post a copy of the script I'm using to generate
>> my test
>> repositories and the commands that I'm executing on them.
>>
>> - Jim
>> --
>> View this message in context:
>>
>> http://mercurial.808500.n3.nabble.com/Subrepo-behavior-doesn-t-seem-to-match-documentation-tp960563p960563.html
>> Sent from the General mailing list archive at Nabble.com.
>> _______________________________________________
>> Mercurial mailing list
>> Mercurial at selenic.com <mailto:Mercurial at selenic.com>
>>
>> http://selenic.com/mailman/listinfo/mercurial
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20100712/27ebfef0/attachment.html>
More information about the Mercurial
mailing list