D2215: httppeer: remove redundant code to fetch capabilities
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Feb 13 03:48:44 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
_fetchcaps() is called by httppeer.instance(), which is the only
instantiator of httppeer. Since _fetchcaps() always sets self._caps
and since https://phab.mercurial-scm.org/rHG197d10e157ce848129ff5e7a53cf81d4ca63a932 removed the fallback for cases where the
remote doesn't support capabilities, we can remove some dead
code from httppeer.capabilities().
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2215
AFFECTED FILES
mercurial/httppeer.py
CHANGE DETAILS
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -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.
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list