branch name in hg view

Sean Kelley svk.sweng at gmail.com
Mon Jan 14 22:37:15 UTC 2008


Hi,

On Jan 14, 2008 2:49 PM, Patrick Mézard <pmezard at gmail.com> wrote:
> Dustin Sallings a écrit :
> >       I'm looking at an hg view output for my project and I can't see the
> > branch name.  It seems that this is using the following command:
> >
> >       hg --config ui.report_untrusted=false debug-rev-list --header --topo-
> > order --parents
> >
> >       How would I go about getting branch name into that export?  I don't
> > see where it's defined.
> >
> >       Would adding branch information break anything?
> >
>
> Does it work for you ? (based on crew tip, but should apply on your version)

I think that would even be useful for submission to Crew so that the
branch name is visible.

Sean
>
> # HG changeset patch
> # User Patrick Mezard <pmezard at gmail.com>
> # Date 1200343510 -3600
> # Node ID ccb4dd9230e4a342b2c2b1464b311b3b5dc1ecf4
> # Parent  a6ccb957fd079f1b5d2ffcc3fadf1940bf5cb513
> hgk: display branch name in patch header
>
> diff --git a/contrib/hgk b/contrib/hgk
> --- a/contrib/hgk
> +++ b/contrib/hgk
> @@ -274,6 +274,7 @@ proc parsecommit {id contents listed old
>      set comname {}
>      set comdate {}
>      set rev {}
> +    set branch {}
>      if {![info exists nchildren($id)]} {
>         set children($id) {}
>         set nchildren($id) 0
> @@ -310,6 +311,8 @@ proc parsecommit {id contents listed old
>                     set comname [join [lrange $line 1 [expr {$x - 1}]]]
>                 } elseif {$tag == "revision"} {
>                     set rev [lindex $line 1]
> +        } elseif {$tag == "branch"} {
> +                   set branch [lindex $line 1]
>                 }
>             }
>         } else {
> @@ -334,7 +337,7 @@ proc parsecommit {id contents listed old
>         set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
>      }
>      set commitinfo($id) [list $headline $auname $audate \
> -                            $comname $comdate $comment $rev]
> +                            $comname $comdate $comment $rev $branch]
>  }
>
>  proc readrefs {} {
> @@ -2286,6 +2289,9 @@ proc selectline {l isnew} {
>      $ctext mark gravity fmark.0 left
>      set info $commitinfo($id)
>      $ctext insert end "Revision: [lindex $info 6]\n"
> +    if {[llength [lindex $info 7]] > 0} {
> +        $ctext insert end "Branch: [lindex $info 7]\n"
> +    }
>      $ctext insert end "Author: [lindex $info 1]  [lindex $info 2]\n"
>      $ctext insert end "Committer: [lindex $info 3]  [lindex $info 4]\n"
>      if {[info exists idtags($id)]} {
> diff --git a/hgext/hgk.py b/hgext/hgk.py
> --- a/hgext/hgk.py
> +++ b/hgext/hgk.py
> @@ -121,6 +121,7 @@ def catcommit(repo, n, prefix, ctx=None)
>      print "author %s %s %s" % (ctx.user(), int(date[0]), date[1])
>      print "committer %s %s %s" % (committer, int(date[0]), date[1])
>      print "revision %d" % ctx.rev()
> +    print "branch %s" % ctx.branch()
>      print ""
>      if prefix != "":
>          print "%s%s" % (prefix, description.replace('\n', nlprefix).strip())
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>




More information about the Mercurial mailing list