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

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 20, 2017, 2:36 p.m.
Message ID <7a50f1a586182a0cf823.1511188592@neuro>
Download mbox | patch
Permalink /patch/25651/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 20, 2017, 2:36 p.m.
# HG changeset patch
# User Anton Shestakov <av6@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().

Patch

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()