[PATCH 1 of 2] hgweb: check changeset's original branch in graphdata()

Anton Shestakov av6 at dwimlabs.net
Mon Nov 20 14:36:32 UTC 2017


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1511185631 -28800
#      Mon Nov 20 21:47:11 2017 +0800
# Node ID 7a50f1a586182a0cf8237ef969f232a3b73c12a5
# Parent  0b66e2d7a70be775e97c076376b7f8e5078ce228
# EXP-Topic hgweb-cleanup
hgweb: check changeset's original branch in graphdata()

This piece of code checks if a changeset is the tip of its branch, but as can
be seen above in the context, "branch" was prepared for being displayed in
hgweb by making it unicode and passing it through url.escape. It's better to
use the original ctx.branch().

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1255,7 +1255,7 @@ def graph(web, req, tmpl):
             user = url.escape(templatefilters.person(encodestr(ctx.user())))
             branch = url.escape(encodestr(ctx.branch()))
             try:
-                branchnode = web.repo.branchtip(branch)
+                branchnode = web.repo.branchtip(ctx.branch())
             except error.RepoLookupError:
                 branchnode = None
             branch = branch, branchnode == ctx.node()


More information about the Mercurial-devel mailing list