hg pull (with branch name)

Kai Grossjohann kai.grossjohann at verizonbusiness.com
Wed Jun 4 03:18:46 CDT 2008


IMHO, one should not use the "-r" switch with pull.  Here is why:

Assume for the sake of discussion that you never edit any files.  In 
this case, one could describe Mercurial as follows:  Each Mercurial 
repository is paired with a working copy.  The repository contains the 
history, and the working copy contains one of the revisions in that 
history.  You use "hg update $REVISION" to select the revision that is 
visible in the working copy.

Then, you can have several repositories that contain similar data (that 
are clones of each other).  By going to repo A and issuing "hg pull B" 
you are copying all history from B to A that is still missing from A.  
If you then do the reverse (go to B and say "hg pull A"), then you know 
that the two repos contain the exact same history.

Now, if you use the "-r" switch to pull, then you copy less than all 
history.  (In any case, you still have to use "hg update" to select what 
is shown in the working copy.)  Given that having all history available 
in all repos is the premier advantage of distributed version control, 
there is little reason to selectively copy a part of the history.

I do not know Hudson, but perhaps in addition to a setting "revision to 
pull" (which should be empty), it also has a setting "revision to build" 
(which is hopefully passed to "hg update").

Kai

PS: If you do edit files, then the "hg update" part becomes more 
complicated.  But I guess that Hudson does not edit files before 
building, it just builds specific versions.  So editing files is not 
relevant here.

Alex Van Boxel wrote:
> Hi all,
>
> first of all, I'm new to mercurial and distributed version management
> systems, but I'm impressed :). Now I came across to some inconsistency
> across products and was wondering if it was
>
> a) a misconception of me
> b) a bug in Mercurial.
> c) a bug in the Mercurial plug-in for Hudson.
>
> I'm trying to put together a demo to persuade our company to switch
> version management system. So I put all our source in hg and made it
> buildable. Everything seems to work ok, till I tried to make a build
> task in Hudson (an extensible continuous integration engine
> https://hudson.dev.java.net/) with the mercurial plug-in.
>
> I made a task to build on of our branches, in this case XQXQ3.0 . What
> is did is get the branch from the repository with every branch (I've
> modelled the repository, so the culture shock will not be to great).
> What I saw is that it only pulled the revision till the first revision
> where the branch was created, so I did some experimenting with the
> command line and I got the same result (see below). If it's a) a
> misconception of me, then I think the people who designed the plug-in
> for Hudson have the same. Anyone an idea? Thanks.
>
> W:\HG\REP>hg branches
> default                        71:be8339994105
> XQXQ3.2                        70:df2166569290 (inactive)
> XQXQ3.1                        65:84af38e5361e (inactive)
> XQXQ3.0                        60:cca9f815298f (inactive)
> XQXQ 3.0GA - April 2007        26:290e5c6fb7a5 (inactive)
>
>
> W:\HG\build>hg init
>
>
> W:\HG\build>hg pull -r XQXQ3.0 ..\REP
> pulling from ..\REP
> requesting all changes
> adding changesets
> adding manifests
> adding file changes
> added 32 changesets with 1283 changes to 1241 files
> (run 'hg update' to get a working copy)
>
>
> W:\HG\build>hg branches
> XQXQ3.0                        31:cca9f815298f
> XQXQ 3.0GA - April 2007        26:290e5c6fb7a5 (inactive)
> default                        25:0aa75316cb38 (inactive)
>
>
> W:\HG\build>hg version
> Mercurial Distributed SCM (version 1.0.1+20080525)
>
>   _/
>  _/ Alex Van Boxel
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>
>   


More information about the Mercurial mailing list