changeset 49719:06083c5f9e29

path: pass `path` to `peer` in `hg pull` We directly use the `path` object to build the `peer` object. We don't use it for sub-repositories yet, which will have to be fixed at some point.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 01 Dec 2022 18:41:59 +0100
parents e64b1e9f4892
children bcb172e360d0
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Dec 01 18:19:08 2022 +0100
+++ b/mercurial/commands.py	Thu Dec 01 18:41:59 2022 +0100
@@ -5431,12 +5431,12 @@
         raise error.InputError(msg, hint=hint)
 
     for path in urlutil.get_pull_paths(repo, ui, sources):
-        source, branches = urlutil.parseurl(path.rawloc, opts.get(b'branch'))
-        ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(source))
+        ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(path.loc))
         ui.flush()
-        other = hg.peer(repo, opts, source)
+        other = hg.peer(repo, opts, path)
         update_conflict = None
         try:
+            branches = (path.branch, opts.get(b'branch', []))
             revs, checkout = hg.addbranchrevs(
                 repo, other, branches, opts.get(b'rev')
             )
@@ -5512,8 +5512,12 @@
                     elif opts.get(b'branch'):
                         brev = opts[b'branch'][0]
                     else:
-                        brev = branches[0]
-                repo._subtoppath = source
+                        brev = path.branch
+
+                # XXX path: we are losing the `path` object here. Keeping it
+                # would be valuable. For example as a "variant" as we do
+                # for pushes.
+                repo._subtoppath = path.loc
                 try:
                     update_conflict = postincoming(
                         ui, repo, modheads, opts.get(b'update'), checkout, brev