[PATCH 1 of 2 STABLE] httppeer: properly gate debug usage behind debug flag check

Boris Feld boris.feld at octobus.net
Mon May 21 10:40:06 EDT 2018

# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1525453606 -7200
#      Fri May 04 19:06:46 2018 +0200
# Branch stable
# Node ID 413f444c264455169af8ff0431a36f9901afc36a
# Parent  273ea09f65500ea7936afe2983bf6a126c5bf4e6
# EXP-Topic stable-dbg-bug
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 413f444c2644
httppeer: properly gate debug usage behind debug flag check

The "dbg" local variable is only defined if the 'debugflag' is set to True.
However, it was used indiscriminately later in the function. We hide its usage
behind the 'debugflag' value to avoid raising a NameError.

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -319,7 +319,7 @@ def sendrequest(ui, opener, req):
         raise IOError(None, inst)
-        if ui.configbool('devel', 'debug.peer-request'):
+        if ui.debugflag and ui.configbool('devel', 'debug.peer-request'):
             dbg(line % '  finished in %.4f seconds (%d)'
                 % (util.timer() - start, res.code))

More information about the Mercurial-devel mailing list