Patchwork [1,of,8,V2] protocol: declare transport protocol name

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 29, 2016, 6:58 a.m.
Message ID <05d19f908c3abf62e2ed.1480402698@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17775/
State Accepted
Headers show

Comments

Gregory Szorc - Nov. 29, 2016, 6:58 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1480394819 28800
#      Mon Nov 28 20:46:59 2016 -0800
# Node ID 05d19f908c3abf62e2ed6d453a8cd52bbc727408
# Parent  64b55bffc1c059eb4c11ca195b561ca8a287f59e
protocol: declare transport protocol name

We add an attribute to the HTTP and SSH protocol implementations
identifying the transport so future patches can conditionally
expose capabilities on a per-transport basis.

Patch

diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -30,6 +30,8 @@  class webproto(wireproto.abstractserverp
         self.req = req
         self.response = ''
         self.ui = ui
+        self.name = 'http'
+
     def getargs(self, args):
         knownargs = self._args()
         data = {}
diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py
--- a/mercurial/sshserver.py
+++ b/mercurial/sshserver.py
@@ -26,6 +26,7 @@  class sshserver(wireproto.abstractserver
         self.lock = None
         self.fin = ui.fin
         self.fout = ui.fout
+        self.name = 'ssh'
 
         hook.redirect(True)
         ui.fout = repo.ui.fout = ui.ferr