changeset 49858:2a5feacc4085

addbranchrevs: explicitly detect the need to fetch a peer Instead of having `peer()` method on all `peer()` for this usecase, we could simply handle it explicitly.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 02 Dec 2022 19:15:04 +0100
parents 0d7ecac8b6f7
children 8a38cd76588f
files mercurial/hg.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Dec 02 17:01:54 2022 +0100
+++ b/mercurial/hg.py	Fri Dec 02 19:15:04 2022 +0100
@@ -66,7 +66,11 @@
 
 
 def addbranchrevs(lrepo, other, branches, revs):
-    peer = other.peer()  # a courtesy to callers using a localrepo for other
+    if util.safehasattr(other, 'peer'):
+        # a courtesy to callers using a localrepo for other
+        peer = other.peer()
+    else:
+        peer = other
     hashbranch, branches = branches
     if not hashbranch and not branches:
         x = revs or None