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.
--- 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