Patchwork D3860: httppeer: fix use of uninitialized variable with devel logging

login
register
mail settings
Submitter phabricator
Date June 30, 2018, 11:04 p.m.
Message ID <255dc6b4fbb9e84e942ac75b5b9175a5@localhost.localdomain>
Download mbox | patch
Permalink /patch/32531/
State Not Applicable
Headers show

Comments

phabricator - June 30, 2018, 11:04 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2279d90eed9a: httppeer: fix use of uninitialized variable with devel logging (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3860?vs=9362&id=9379

REVISION DETAIL
  https://phab.mercurial-scm.org/D3860

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -306,6 +306,7 @@ 
 
         start = util.timer()
 
+    res = None
     try:
         res = opener.open(req)
     except urlerr.httperror as inst:
@@ -319,8 +320,9 @@ 
         raise IOError(None, inst)
     finally:
         if ui.debugflag and ui.configbool('devel', 'debug.peer-request'):
+            code = res.code if res else -1
             dbg(line % '  finished in %.4f seconds (%d)'
-                % (util.timer() - start, res.code))
+                % (util.timer() - start, code))
 
     # Insert error handlers for common I/O failures.
     _wraphttpresponse(res)