[PATCH 2 of 2 STABLE] httppeer: declare 'dgb' at the function level

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


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1526908486 -7200
#      Mon May 21 15:14:46 2018 +0200
# Branch stable
# Node ID 06458d4a1ca84506d04280052d0288221b2701f0
# Parent  413f444c264455169af8ff0431a36f9901afc36a
# EXP-Topic stable-dbg-bug
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 06458d4a1ca8
httppeer: declare 'dgb' at the function level

As we just saw in the previous changeset, having the variable defined into a
branch creates bug. This is a cheap to move it at the function level.

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -277,9 +277,9 @@ def sendrequest(ui, opener, req):
 
     Returns the response object.
     """
+    dbg = ui.debug
     if (ui.debugflag
         and ui.configbool('devel', 'debug.peer-request')):
-        dbg = ui.debug
         line = 'devel-peer-request: %s\n'
         dbg(line % '%s %s' % (pycompat.bytesurl(req.get_method()),
                               pycompat.bytesurl(req.get_full_url())))


More information about the Mercurial-devel mailing list