Patchwork D2024: sshpeer: make "instance" a function

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2018, 3:35 a.m.
Message ID <differential-rev-PHID-DREV-i4d6giu3675k6tjqpz6n-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27284/
State Superseded
Headers show

Comments

phabricator - Feb. 5, 2018, 3:35 a.m.
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




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

Patch

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)