peer: have `repo.peer` take an optional `path` argument
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 03 Dec 2022 00:16:07 +0100
changeset 49753 ff7134e03629
parent 49752 611ccb631cbc
child 49754 ec30fe6917ec
peer: have `repo.peer` take an optional `path` argument We are ready to start to actually set the value now.
hgext/narrow/narrowrepo.py
mercurial/bundlerepo.py
mercurial/interfaces/repository.py
mercurial/localrepo.py
mercurial/statichttprepo.py
mercurial/unionrepo.py
tests/notcapable
--- a/hgext/narrow/narrowrepo.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/hgext/narrow/narrowrepo.py	Sat Dec 03 00:16:07 2022 +0100
@@ -19,8 +19,8 @@
             dirstate = super(narrowrepository, self)._makedirstate()
             return narrowdirstate.wrapdirstate(self, dirstate)
 
-        def peer(self):
-            peer = super(narrowrepository, self).peer()
+        def peer(self, path=None):
+            peer = super(narrowrepository, self).peer(path=path)
             peer._caps.add(wireprototypes.NARROWCAP)
             peer._caps.add(wireprototypes.ELLIPSESCAP)
             return peer
--- a/mercurial/bundlerepo.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/mercurial/bundlerepo.py	Sat Dec 03 00:16:07 2022 +0100
@@ -458,8 +458,8 @@
     def cancopy(self):
         return False
 
-    def peer(self):
-        return bundlepeer(self)
+    def peer(self, path=None):
+        return bundlepeer(self, path=path)
 
     def getcwd(self):
         return encoding.getcwd()  # always outside the repo
--- a/mercurial/interfaces/repository.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/mercurial/interfaces/repository.py	Sat Dec 03 00:16:07 2022 +0100
@@ -1612,7 +1612,7 @@
     def close():
         """Close the handle on this repository."""
 
-    def peer():
+    def peer(path=None):
         """Obtain an object conforming to the ``peer`` interface."""
 
     def unfiltered():
--- a/mercurial/localrepo.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/mercurial/localrepo.py	Sat Dec 03 00:16:07 2022 +0100
@@ -303,8 +303,8 @@
 class localpeer(repository.peer):
     '''peer for a local repo; reflects only the most recent API'''
 
-    def __init__(self, repo, caps=None):
-        super(localpeer, self).__init__(repo.ui)
+    def __init__(self, repo, caps=None, path=None):
+        super(localpeer, self).__init__(repo.ui, path=path)
 
         if caps is None:
             caps = moderncaps.copy()
@@ -451,8 +451,8 @@
     """peer extension which implements legacy methods too; used for tests with
     restricted capabilities"""
 
-    def __init__(self, repo):
-        super(locallegacypeer, self).__init__(repo, caps=legacycaps)
+    def __init__(self, repo, path=None):
+        super(locallegacypeer, self).__init__(repo, caps=legacycaps, path=path)
 
     # Begin of baselegacywirecommands interface.
 
@@ -1633,8 +1633,8 @@
                 parts.pop()
         return False
 
-    def peer(self):
-        return localpeer(self)  # not cached to avoid reference cycle
+    def peer(self, path=None):
+        return localpeer(self, path=path)  # not cached to avoid reference cycle
 
     def unfiltered(self):
         """Return unfiltered version of the repository
--- a/mercurial/statichttprepo.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/mercurial/statichttprepo.py	Sat Dec 03 00:16:07 2022 +0100
@@ -236,8 +236,8 @@
     def local(self):
         return False
 
-    def peer(self):
-        return statichttppeer(self)
+    def peer(self, path=None):
+        return statichttppeer(self, path=path)
 
     def wlock(self, wait=True):
         raise error.LockUnavailable(
--- a/mercurial/unionrepo.py	Sat Dec 03 00:13:50 2022 +0100
+++ b/mercurial/unionrepo.py	Sat Dec 03 00:16:07 2022 +0100
@@ -257,8 +257,8 @@
     def cancopy(self):
         return False
 
-    def peer(self):
-        return unionpeer(self)
+    def peer(self, path=None):
+        return unionpeer(self, path=None)
 
     def getcwd(self):
         return encoding.getcwd()  # always outside the repo
--- a/tests/notcapable	Sat Dec 03 00:13:50 2022 +0100
+++ b/tests/notcapable	Sat Dec 03 00:16:07 2022 +0100
@@ -15,10 +15,10 @@
     if name in b'$CAP'.split(b' '):
         return False
     return orig(self, name, *args, **kwargs)
-def wrappeer(orig, self):
+def wrappeer(orig, self, path=None):
     # Since we're disabling some newer features, we need to make sure local
     # repos add in the legacy features again.
-    return localrepo.locallegacypeer(self)
+    return localrepo.locallegacypeer(self, path=path)
 EOF
 
 echo '[extensions]' >> $HGRCPATH