changeset 49747:8a38cd76588f

clone: 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 Sat, 03 Dec 2022 03:45:39 +0100
parents 2a5feacc4085
children 78af51ba73c5
files mercurial/hg.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Dec 02 19:15:04 2022 +0100
+++ b/mercurial/hg.py	Sat Dec 03 03:45:39 2022 +0100
@@ -717,6 +717,11 @@
             branches = (src_path.branch, branch or [])
             source = src_path.loc
     else:
+        if util.safehasattr(source, 'peer'):
+            srcpeer = source.peer()  # in case we were called with a localrepo
+        else:
+            srcpeer = source
+        branches = (None, branch or [])
         # XXX path: simply use the peer `path` object when this become available
         srcpeer = source.peer()  # in case we were called with a localrepo
         branches = (None, branch or [])