changeset 36257:a463f375f021

httppeer: remove redundant code to fetch capabilities _fetchcaps() is called by httppeer.instance(), which is the only instantiator of httppeer. Since _fetchcaps() always sets self._caps and since 197d10e157ce removed the fallback for cases where the remote doesn't support capabilities, we can remove some dead code from httppeer.capabilities(). Differential Revision: https://phab.mercurial-scm.org/D2215
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 12 Feb 2018 17:10:58 -0800
parents e4ccd7a69f77
children 874209855f5c
files mercurial/httppeer.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httppeer.py	Thu Feb 01 19:32:42 2018 -0800
+++ b/mercurial/httppeer.py	Mon Feb 12 17:10:58 2018 -0800
@@ -221,13 +221,9 @@
     # Begin of _basewirepeer interface.
 
     def capabilities(self):
-        if self._caps is None:
-            try:
-                self._fetchcaps()
-            except error.RepoError:
-                self._caps = set()
-            self.ui.debug('capabilities: %s\n' %
-                          (' '.join(self._caps or ['none'])))
+        # self._fetchcaps() should have been called as part of peer
+        # handshake. So self._caps should always be set.
+        assert self._caps is not None
         return self._caps
 
     # End of _basewirepeer interface.