diff mercurial/httppeer.py @ 37321:e826fe7a08c7

peer: make ui an attribute With abc interfaces, instance attributes could not satisfy @abc.abstractproperty requirements because interface conformance was tested at type creation time. When we created the abc peer interfaces, we had to make "ui" a @property to satisfy abc. Now that peer interfaces are using zope.interface and there is no import time validation (but there are tests validating instances conform to the interface), we can go back to using regular object attributes. Differential Revision: https://phab.mercurial-scm.org/D3069
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 30 Mar 2018 18:57:13 -0700
parents 39f7d4ee8bcd
children 3e1688711efd
line wrap: on
line diff
--- a/mercurial/httppeer.py	Fri Mar 30 18:53:17 2018 -0700
+++ b/mercurial/httppeer.py	Fri Mar 30 18:57:13 2018 -0700
@@ -135,7 +135,7 @@
 
 class httppeer(wireproto.wirepeer):
     def __init__(self, ui, path, url, opener):
-        self._ui = ui
+        self.ui = ui
         self._path = path
         self._url = url
         self._caps = None
@@ -150,9 +150,9 @@
             getattr(h, "close_all", lambda: None)()
 
     def _openurl(self, req):
-        if (self._ui.debugflag
-            and self._ui.configbool('devel', 'debug.peer-request')):
-            dbg = self._ui.debug
+        if (self.ui.debugflag
+            and self.ui.configbool('devel', 'debug.peer-request')):
+            dbg = self.ui.debug
             line = 'devel-peer-request: %s\n'
             dbg(line % '%s %s' % (req.get_method(), req.get_full_url()))
             hgargssize = None
@@ -179,17 +179,13 @@
             start = util.timer()
 
         ret = self._urlopener.open(req)
-        if self._ui.configbool('devel', 'debug.peer-request'):
+        if self.ui.configbool('devel', 'debug.peer-request'):
             dbg(line % '  finished in %.4f seconds (%s)'
                 % (util.timer() - start, ret.code))
         return ret
 
     # Begin of ipeerconnection interface.
 
-    @util.propertycache
-    def ui(self):
-        return self._ui
-
     def url(self):
         return self._path