[PATCH 3 of 3] webcommands: test that fctx is not None in filediff()

Anton Shestakov av6 at dwimlabs.net
Tue Dec 1 07:43:23 CST 2015


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1448701589 -28800
#      Sat Nov 28 17:06:29 2015 +0800
# Node ID 8264c8f4ddcee32c1d89b1adbdfe1a9d624b1ba7
# Parent  91c232ae86ca05a9a8c71d7b9e6e8d4587b7417e
webcommands: test that fctx is not None in filediff()

A block of code above this one already says "if fctx is not None", and it's
also what this code actually intends to check, so let's be specific as PEP-8
recommends.

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -792,7 +792,7 @@ def filediff(web, req, tmpl):
         style = req.form['style'][0]
 
     diffs = webutil.diffs(web.repo, tmpl, ctx, None, [path], parity, style)
-    if fctx:
+    if fctx is not None:
         rename = webutil.renamelink(fctx)
         ctx = fctx
     else:


More information about the Mercurial-devel mailing list