D2024: sshpeer: make "instance" a function

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


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

REVISION SUMMARY
  The API is that peer modules must provide an "instance" symbol
  that is callable to return a peer.
  
  Making "instance" a function instead of an alias to "sshpeer"
  makes it easier to monkeypatch the "sshpeer" type. It will also
  make it possible to turn instance() into a factory function of
  sorts that returns different types based on connection properties.

REPOSITORY
  rHG Mercurial

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

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
@@ -370,4 +370,5 @@
             self._pipeo.flush()
         self._readerr()
 
-instance = sshpeer
+def instance(ui, path, create):
+    return sshpeer(ui, path, create=create)



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


More information about the Mercurial-devel mailing list