Patchwork hgweb: remove duplicate branch data passed to changeset template

login
register
mail settings
Submitter Anton Shestakov
Date May 25, 2015, 11:46 a.m.
Message ID <65ffd07ea1421ec83e23.1432554406@neuro>
Download mbox | patch
Permalink /patch/9256/
State Rejected
Delegated to: Augie Fackler
Headers show

Comments

Anton Shestakov - May 25, 2015, 11:46 a.m.
# HG changeset patch
# User Anton Shestakov <engored@ya.ru>
# Date 1431845004 -28800
#      Sun May 17 14:43:24 2015 +0800
# Node ID 65ffd07ea1421ec83e23b74794c6d123a5623079
# Parent  605b1d32c1c011d56233f28923ee5354fce7e426
hgweb: remove duplicate branch data passed to changeset template

The changesetbranch was added in f1111704061e, but there was no need to do
that, since the data passed to changeset template already includes branch, that
is obtained in the same exact way (nodebranchnodefault(ctx)). I.e.
changesetbranch is completely redundant.
Augie Fackler - May 26, 2015, 2:45 p.m.
On Mon, May 25, 2015 at 07:46:46PM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <engored@ya.ru>
> # Date 1431845004 -28800
> #      Sun May 17 14:43:24 2015 +0800
> # Node ID 65ffd07ea1421ec83e23b74794c6d123a5623079
> # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
> hgweb: remove duplicate branch data passed to changeset template

This looks like it'll probably break custom themes people have
installed locally. We could probably factor out the duplicate call to
nodebranchnodefault() though (I'm assuming it happens, I didn't load
it up to be sure.)

>
> The changesetbranch was added in f1111704061e, but there was no need to do
> that, since the data passed to changeset template already includes branch, that
> is obtained in the same exact way (nodebranchnodefault(ctx)). I.e.
> changesetbranch is completely redundant.
>
> diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
> --- a/mercurial/hgweb/webutil.py
> +++ b/mercurial/hgweb/webutil.py
> @@ -285,7 +285,6 @@ def changesetentry(web, req, tmpl, ctx):
>      showtags = showtag(web.repo, tmpl, 'changesettag', ctx.node())
>      showbookmarks = showbookmark(web.repo, tmpl, 'changesetbookmark',
>                                   ctx.node())
> -    showbranch = nodebranchnodefault(ctx)
>
>      files = []
>      parity = paritygen(web.stripecount)
> @@ -319,7 +318,6 @@ def changesetentry(web, req, tmpl, ctx):
>          basenode=basectx.hex(),
>          changesettag=showtags,
>          changesetbookmark=showbookmarks,
> -        changesetbranch=showbranch,
>          author=ctx.user(),
>          desc=ctx.description(),
>          extra=ctx.extra(),
> diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
> --- a/mercurial/templates/paper/changeset.tmpl
> +++ b/mercurial/templates/paper/changeset.tmpl
> @@ -31,7 +31,7 @@
>  <div class="main">
>
>  <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
> -<h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
> +<h3>changeset {rev}:{node|short} {branch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
>
>  <form class="search" action="{url|urlescape}log">
>  {sessionvars%hiddenformentry}
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -285,7 +285,6 @@  def changesetentry(web, req, tmpl, ctx):
     showtags = showtag(web.repo, tmpl, 'changesettag', ctx.node())
     showbookmarks = showbookmark(web.repo, tmpl, 'changesetbookmark',
                                  ctx.node())
-    showbranch = nodebranchnodefault(ctx)
 
     files = []
     parity = paritygen(web.stripecount)
@@ -319,7 +318,6 @@  def changesetentry(web, req, tmpl, ctx):
         basenode=basectx.hex(),
         changesettag=showtags,
         changesetbookmark=showbookmarks,
-        changesetbranch=showbranch,
         author=ctx.user(),
         desc=ctx.description(),
         extra=ctx.extra(),
diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
--- a/mercurial/templates/paper/changeset.tmpl
+++ b/mercurial/templates/paper/changeset.tmpl
@@ -31,7 +31,7 @@ 
 <div class="main">
 
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
-<h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
+<h3>changeset {rev}:{node|short} {branch%changelogbranchname} {changesettag} {changesetbookmark}</h3>
 
 <form class="search" action="{url|urlescape}log">
 {sessionvars%hiddenformentry}