Patchwork D3069: peer: make ui an attribute

login
register
mail settings
Submitter phabricator
Date April 4, 2018, 1:40 p.m.
Message ID <2f66dc03cc20f7d69580a70853181941@localhost.localdomain>
Download mbox | patch
Permalink /patch/30255/
State Not Applicable
Headers show

Comments

phabricator - April 4, 2018, 1:40 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe826fe7a08c7: peer: make ui an attribute (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3069?vs=7612&id=7621

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

AFFECTED FILES
  mercurial/httppeer.py
  mercurial/localrepo.py
  mercurial/sshpeer.py
  tests/test-wireproto.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py
--- a/tests/test-wireproto.py
+++ b/tests/test-wireproto.py
@@ -32,11 +32,7 @@ 
 class clientpeer(wireproto.wirepeer):
     def __init__(self, serverrepo, ui):
         self.serverrepo = serverrepo
-        self._ui = ui
-
-    @property
-    def ui(self):
-        return self._ui
+        self.ui = ui
 
     def url(self):
         return b'test'
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -354,7 +354,7 @@ 
         stderr and to forward its output.
         """
         self._url = url
-        self._ui = ui
+        self.ui = ui
         # self._subprocess is unused. Keeping a handle on the process
         # holds a reference and prevents it from being garbage collected.
         self._subprocess = proc
@@ -379,10 +379,6 @@ 
 
     # Begin of ipeerconnection interface.
 
-    @util.propertycache
-    def ui(self):
-        return self._ui
-
     def url(self):
         return self._url
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -162,15 +162,11 @@ 
         if caps is None:
             caps = moderncaps.copy()
         self._repo = repo.filtered('served')
-        self._ui = repo.ui
+        self.ui = repo.ui
         self._caps = repo._restrictcapabilities(caps)
 
     # Begin of _basepeer interface.
 
-    @util.propertycache
-    def ui(self):
-        return self._ui
-
     def url(self):
         return self._repo.url()
 
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -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