diff branches

Thomas Arendsen Hein thomas at intevation.de
Tue Dec 19 01:51:57 CST 2006


* Bryan Murdock <bmurdock at gmail.com> [20061219 00:33]:
> On 12/18/06, Thomas Arendsen Hein <thomas at intevation.de> wrote:
> >WHat you can do now is:
> >hg clone repo1 foo
> >cd foo
> >hg pull ../repo2
> >hg diff -rtip
> 
> Ahhh, of course.  I've read the man pages and scoured the wiki and it
> does seem like creating a branch is the solution (or, workaround) to a
> lot of problems.

cloning/branching is _the_ central thing in Mercurial, not just a
workaround.

> The one thing I wonder is how long creating a branch
> takes for a really big project, especially if repo1 in this example is
> on another machine?

If repo1 is on another machine, swap repo1 and repo2.

To speed up everything a little, you can clone the repository
without creating a working copy, but then you have to manually
remember the changeset you want to compare to:

hg clone -U local-repo foo  # takes few seconds and needs nearly no disk space
cd foo
hg tip -q
(prints e.g. 3898:93e5f07baf75)
hg pull ../remote-repo
hg diff -r3898 -rtip

Or using a little bit black magic instead of human brain:
hg clone -U local-repo foo  # takes few seconds and needs nearly no disk space
cd foo
hg debugsetparents tip
hg pull ../remote-repo
hg diff -r. -rtip
(if you plan to use the working directory of this repo, you need to
 type 'hg debugsetparents null' before using 'hg update'!)

In both cases you can do
 cd ../local-repo
 hg pull -u ../foo
to pull the remote changes into your local repo without needing to
transfer them again.

I think similar things can be done using 'hg incoming' with the
--bundle option and them using hg diff -R bundlefile while being in
the local repo, but I haven't tested this.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list