D2030: sshpeer: remove frivolous call to _cleanup()

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Feb 5 03:35:48 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  _validaterepo() is called once during __init__. _cleanup()
  no-ops if the self._pipe* attributes aren't set. These attributes
  are set during _validaterepo(). So the call to _cleanup() isn't
  necessary.
  
  But just to be on the safe side, we add an assertion.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2030

AFFECTED FILES
  mercurial/sshpeer.py

CHANGE DETAILS

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -173,8 +173,7 @@
     # End of _basewirecommands interface.
 
     def _validaterepo(self, sshcmd, args, remotecmd, sshenv=None):
-        # cleanup up previous run
-        self._cleanup()
+        assert self._pipei is None
 
         cmd = '%s %s %s' % (sshcmd, args,
             util.shellquote("%s -R %s serve --stdio" %



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list