diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
index 38fe3fe4bbb639d8bc082c5710ace24cb6f86375_bWVyY3VyaWFsL2hnd2ViL3dlYmNvbW1hbmRzLnB5..4bc74bc78efdbb413afa3dcc4ff65ed979522965_bWVyY3VyaWFsL2hnd2ViL3dlYmNvbW1hbmRzLnB5 100644
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1255,7 +1255,7 @@
             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()