# HG changeset patch # User Pierre-Yves David # Date 2022-12-03 02:45:39 # Node ID 8a38cd76588fd5f493218059ec0cd08a2c740c0c # Parent 2a5feacc4085630bde395654c20cf4299f34fe17 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. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -717,6 +717,11 @@ def clone( 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 [])