mercurial/hgweb/webcommands.py
changeset 27158 522ffc189671
parent 27081 37290f2f2c3b
child 27159 7e10b860c174
--- a/mercurial/hgweb/webcommands.py	Mon Nov 30 16:38:29 2015 -0800
+++ b/mercurial/hgweb/webcommands.py	Sat Nov 28 16:02:22 2015 +0800
@@ -854,6 +854,7 @@
             return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))]
         return f.data().splitlines()
 
+    fctx = None
     parent = ctx.p1()
     leftrev = parent.rev()
     leftnode = parent.node()
@@ -869,10 +870,14 @@
             leftlines = filelines(pfctx)
     else:
         rightlines = ()
-        fctx = ctx.parents()[0][path]
-        leftlines = filelines(fctx)
+        pfctx = ctx.parents()[0][path]
+        leftlines = filelines(pfctx)
 
     comparison = webutil.compare(tmpl, context, leftlines, rightlines)
+    if fctx is not None:
+        ctx = fctx
+    else:
+        ctx = ctx
     return tmpl('filecomparison',
                 file=path,
                 node=hex(ctx.node()),
@@ -884,8 +889,8 @@
                 author=ctx.user(),
                 rename=rename,
                 branch=webutil.nodebranchnodefault(ctx),
-                parent=webutil.parents(fctx),
-                child=webutil.children(fctx),
+                parent=webutil.parents(ctx),
+                child=webutil.children(ctx),
                 tags=webutil.nodetagsdict(web.repo, ctx.node()),
                 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
                 leftrev=leftrev,