[patch 3/4] named branching is when you identify a head by a tag on an earlier revision.

Chris Mason mason at suse.com
Sat Aug 13 07:09:32 CDT 2005


Matt Mackall wrote:
> On Fri, Aug 12, 2005 at 10:43:44AM -0400, Chris Mason wrote:
> 
>># HG changeset patch
>># User mason at suse.com
>>Add searching for named branches
>>
>>named branching is when you identify a head by a tag on an earlier revision.
>>This patch adds repo.branchlookup for searching through the tree to 
>>find branch tags for heads.
>>
>>hg update -b tag is added to checkout based on branch tags
>>hg heads -b is added to print the tag associated with each head
> 
> 
> Which of the semantics that we discussed at OLS did you end up
> implementing? Amusingly, all my notes are in _your_ notebook.

Heh, sorry about that.
> 
> Is there any attempt to prune tags that are superceded? That is, will
> we see 0.1 and 0.2 both show up on the tip, even if 0.2 is a
> descendent of 0.1?
> 

I took your basic recursive definition:

branch tag = tag of node | branch tag of parent

And added the prune to remove tags that are ancestors of each other.  So
for our difficult case, the 2.6.12 tag goes away because it is an
ancestor of a bunch of other tags.

The prune tries to be efficient.  While walking the tree I keep track of
which tags are ancestors of each head and also which tags are ancestors
of other tags.  Then I look through each of the tags for a given head
and prune.

There is still room for optimization, but hg heads on the linux-2.6 rep
takes .4s and hg heads -b takes .58s.

I did find one bug though, if you merge two tagged branches, the merge
changeset only picks up the tag from one of them.  I'm checking over my
fix here to make sure I didn't break anything and I'll resend.

-chris


More information about the Mercurial mailing list