# HG changeset patch # User Gregory Szorc # Date 2018-02-13 01:10:58 # Node ID a463f375f02188bc7ec4358af147e672eb035aa0 # Parent e4ccd7a69f77e0b81fc68f810c0670a2311aa2c4 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 diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -221,13 +221,9 @@ class httppeer(wireproto.wirepeer): # 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.