Patchwork D1989: wireprotoserver: make response handling attributes private

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 11:32 p.m.
Message ID <67c3ef5420ef843500ea0cd4121a4349@localhost.localdomain>
Download mbox | patch
Permalink /patch/27194/
State Not Applicable
Headers show

Comments

phabricator - Feb. 1, 2018, 11:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6968eb2579a5: wireprotoserver: make response handling attributes private (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1989?vs=5112&id=5127

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

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -283,34 +283,34 @@ 
         return [data[k] for k in keys]
 
     def getfile(self, fpout):
-        self.sendresponse('')
+        self._sendresponse('')
         count = int(self._fin.readline())
         while count:
             fpout.write(self._fin.read(count))
             count = int(self._fin.readline())
 
     def redirect(self):
         pass
 
-    def sendresponse(self, v):
+    def _sendresponse(self, v):
         self._fout.write("%d\n" % len(v))
         self._fout.write(v)
         self._fout.flush()
 
-    def sendstream(self, source):
+    def _sendstream(self, source):
         write = self._fout.write
         for chunk in source.gen:
             write(chunk)
         self._fout.flush()
 
-    def sendpushresponse(self, rsp):
-        self.sendresponse('')
-        self.sendresponse(str(rsp.res))
+    def _sendpushresponse(self, rsp):
+        self._sendresponse('')
+        self._sendresponse(str(rsp.res))
 
-    def sendpusherror(self, rsp):
-        self.sendresponse(rsp.res)
+    def _sendpusherror(self, rsp):
+        self._sendresponse(rsp.res)
 
-    def sendooberror(self, rsp):
+    def _sendooberror(self, rsp):
         self._ui.ferr.write('%s\n-\n' % rsp.message)
         self._ui.ferr.flush()
         self._fout.write('\n')
@@ -321,22 +321,22 @@ 
             pass
         sys.exit(0)
 
-    handlers = {
-        str: sendresponse,
-        wireproto.streamres: sendstream,
-        wireproto.streamres_legacy: sendstream,
-        wireproto.pushres: sendpushresponse,
-        wireproto.pusherr: sendpusherror,
-        wireproto.ooberror: sendooberror,
+    _handlers = {
+        str: _sendresponse,
+        wireproto.streamres: _sendstream,
+        wireproto.streamres_legacy: _sendstream,
+        wireproto.pushres: _sendpushresponse,
+        wireproto.pusherr: _sendpusherror,
+        wireproto.ooberror: _sendooberror,
     }
 
     def serve_one(self):
         cmd = self._fin.readline()[:-1]
         if cmd and cmd in wireproto.commands:
             rsp = wireproto.dispatch(self._repo, self, cmd)
-            self.handlers[rsp.__class__](self, rsp)
+            self._handlers[rsp.__class__](self, rsp)
         elif cmd:
-            self.sendresponse("")
+            self._sendresponse("")
         return cmd != ''
 
     def _client(self):