[prev in list] [next in list] [prev in thread] [next in thread]
List: mercurial
Subject: Re: subrepository example
From: Matt Mackall <mpm () selenic ! com>
Date: 2010-06-29 21:04:28
Message-ID: 1277845468.28498.3346.camel () calx
[Download RAW message or body]
On Mon, 2010-06-21 at 14:30 -0700, rupert.thurner wrote:
> i promised martin last time that i'll try subrepositories. and i am
> quite impressed how this works.
>
> let me post an example, using one hg repository "testhg", containing
> one nested repository. the nested repo is referenced two times inside
> "testhg". at the end we clone "testhg".
>
> hg init testhg
> cd testhg
> hg init nested
> echo nested = nested > .hgsub
> hg add .hgsub
> touch nested/somefile
> hg -R nested add
> hg commit -m "initial subrepo commit"
> mkdir multiple-reference
> hg clone nested multiple-reference/ref1
> echo multiple-reference/ref1 = nested >> .hgsub
> hg clone nested multiple-reference/ref2
> echo multiple-reference/ref2 = nested >> .hgsub
> hg commit -m "refer 2 times to nested"
> echo "direct change to the subrepo" >> nested/somefile
> hg commit -m "subrepo change"
> #hg pull -u
> # this fails? how can one update all subrepos at once?
> # see comment at the end, at 0.
> hg -R multiple-reference/ref1 pull
> hg -R multiple-reference/ref1 merge
> hg commit -m "commit subrepo merge"
> hg -R multiple-reference/ref1 push
> hg -R nested update
> hg -R multiple-reference/ref2 pull -u
> hg commit -m "commit current subrepo state"
> cd ..
> hg clone testhg testhgclone
> cd testhg
> echo "second change of subrepo" >> nested/somefile
> hg commit -m "second change of subrepo, direct"
> hg -R ../testhgclone/ pull -u
> # when we have a local clone, "default" is set on the top-level
> # and pull -u updates all the repos and subrepos correctly.
>
> and i was very surprised that all of this worked quite flawlessy while
> it does not with svn:externals after 7 years of lifetime.
> congratulations!!
>
> but it took a couple of tries to figure out how pull behaves. if "hg
> pull -u" would be more subrepo aware it would help a lot imo. this
> means especially:
>
> 1. even if "pull -u" fails for the top-level repository with "abort:
> repository default not found!"
> it should update all subrepositories, see remark in the above
> example.
Can't. We don't even know what subrepos to pull until update has
occurred because the relevant data is stored in the target changeset.
Further, there's nowhere to -put- a subrepo until the update phase
either.
--
Mathematics is the supreme nostalgia of our time.
_______________________________________________
Mercurial mailing list
Mercurial@selenic.com
http://selenic.com/mailman/listinfo/mercurial
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic