branch and revision together

Martin Geisler mg at lazybytes.net
Thu Aug 26 09:28:50 UTC 2010


Brad Schick <schickb at gmail.com> writes:

> Working on a project that is going to use named branches to keep track
> of parallel work. Different deployment environments will run from
> different branches (dev, test, pre-prod, etc) and for efficiency I
> wanted pull changes from just the branch in use. Furthermore an
> environment may need to be a specific revision. We could always just
> pull with the revision (usually a tag), but that brings down changes
> from all branches. I'm wondering why hg doesn't support limiting
> commands like pull and incoming to both a branch and a revision.

Since all revisions are on some branch, specifying both does not make a
lot of sense. So in your example you should just pull the revision you
want -- Mercurial will then make sure that it pulls the necessary
ancestor revisions too.

> I'd want to get only changes up to that revision related to the
> specified branch. Instead, I get all changes form the branch. Here is
> a simple example using 'default'
>
> $ hg init src
> $ cd src
> $ touch a b c
> $ hg add a
> $ hg ci -m "add a"
> $ hg add b
> $ hg ci -m "add b"
> $ hg add c
> $ hg ci -m "add c"
> $ cd ..
> $ hg init dst
> $ cd dst
> $hg in ../src -r 1 -b default
> comparing with ../src
> changeset:   0:3b0b68ca401f
> user:        schickb
> date:        Wed Aug 25 22:13:47 2010 -0700
> summary:     add a
>
> changeset:   1:96e09e16d8d1
> user:        schickb
> date:        Wed Aug 25 22:14:26 2010 -0700
> summary:     add b
>
> changeset:   2:40c685a9a686
> tag:         tip
> user:        schickb
> date:        Wed Aug 25 22:14:38 2010 -0700
> summary:     add c
>
> I would want that to show only revs [0-1] inclusive

What happens is that 'default' is being looked up in the source
repository and expanded into the branch head, which is revision 2.

The -b flag is really there to help you in case a branch has multiple
heads, in which case 'hg pull -b default' will be correctly turned into
a list of all branch heads.

Compare this with 'hg pull -r default' where you only get the tip-most
revision on default (and its ancestors, of course).

Maybe we should give an error if --rev and --branch are used together?

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20100826/edead373/attachment.asc>


More information about the Mercurial mailing list