wireprotoserver: rename p to proto
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 31 Jan 2018 10:09:41 -0800
changeset 35864 bd38ccf4ecf6
parent 35863 49426bb4476c
child 35865 f084d5131f3e
wireprotoserver: rename p to proto To aid readability. And to make it easier to search the code base for protocol instances. Differential Revision: https://phab.mercurial-scm.org/D1982
mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py	Tue Jan 30 17:51:57 2018 -0800
+++ b/mercurial/wireprotoserver.py	Wed Jan 31 10:09:41 2018 -0800
@@ -194,7 +194,7 @@
     return cmd in wireproto.commands
 
 def callhttp(repo, req, cmd):
-    p = webproto(req, repo.ui)
+    proto = webproto(req, repo.ui)
 
     def genversion2(gen, engine, engineopts):
         # application/mercurial-0.2 always sends a payload header
@@ -207,7 +207,7 @@
         for chunk in gen:
             yield chunk
 
-    rsp = wireproto.dispatch(repo, p, cmd)
+    rsp = wireproto.dispatch(repo, proto, cmd)
     if isinstance(rsp, bytes):
         req.respond(HTTP_OK, HGTYPE, body=rsp)
         return []
@@ -220,7 +220,8 @@
 
         # This code for compression should not be streamres specific. It
         # is here because we only compress streamres at the moment.
-        mediatype, engine, engineopts = p.responsetype(rsp.prefer_uncompressed)
+        mediatype, engine, engineopts = proto.responsetype(
+            rsp.prefer_uncompressed)
         gen = engine.compressstream(gen, engineopts)
 
         if mediatype == HGTYPE2:
@@ -229,14 +230,14 @@
         req.respond(HTTP_OK, mediatype)
         return gen
     elif isinstance(rsp, wireproto.pushres):
-        val = p.restore()
+        val = proto.restore()
         rsp = '%d\n%s' % (rsp.res, val)
         req.respond(HTTP_OK, HGTYPE, body=rsp)
         return []
     elif isinstance(rsp, wireproto.pusherr):
         # drain the incoming bundle
         req.drain()
-        p.restore()
+        proto.restore()
         rsp = '0\n%s\n' % rsp.res
         req.respond(HTTP_OK, HGTYPE, body=rsp)
         return []