[PATCH] graphlog: add -b [BRANCH] argument

Alexis S. L. Carvalho alexis at cecm.usp.br
Mon Feb 11 12:55:33 CST 2008


Thus spake Steve Borho:
> graphlog: add -b [BRANCH] argument
> 
> diff --git a/hgext/graphlog.py b/hgext/graphlog.py
> --- a/hgext/graphlog.py
> +++ b/hgext/graphlog.py
> @@ -12,7 +12,7 @@
>  from mercurial.node import nullid, nullrev
>  from mercurial.util import Abort, canonpath
>  
> -def revision_grapher(repo, start_rev, stop_rev):
> +def revision_grapher(repo, start_rev, stop_rev, branches=[]):
>      """incremental revision grapher
>  
>      This generator function walks through the revision history from
> @@ -40,6 +40,11 @@
>  
>          # Compute revs and next_revs.
>          if curr_rev not in revs:
> +            if branches:
> +                ctx = repo.changectx(curr_rev)
> +                if ctx.branch() not in branches:
> +                    curr_rev -= 1
> +                    continue
>              # New head.
>              revs.append(curr_rev)
>          rev_index = revs.index(curr_rev)

Interesting, but I'd rather see:

- a way for graphlog to show only ancestors of revisions A, B and C
  (probably --follow, but I have to write a rant about log --follow)

- the core code keeping track of all heads of a named branch

This should give us the same feature in a way that would also be useful
without named branches.

Alexis


More information about the Mercurial-devel mailing list