path: pass `path` to `peer` in `hg incoming`
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/hg.py Thu Dec 01 17:55:17 2022 +0100
+++ b/mercurial/hg.py Thu Dec 01 18:19:08 2022 +0100
@@ -1311,23 +1311,28 @@
msg %= len(srcs)
raise error.Abort(msg)
path = srcs[0]
- source, branches = urlutil.parseurl(path.rawloc, opts.get(b'branch'))
- if subpath is not None:
+ if subpath is None:
+ peer_path = path
+ url = path.loc
+ else:
+ # XXX path: we are losing the `path` object here. Keeping it would be
+ # valuable. For example as a "variant" as we do for pushes.
subpath = urlutil.url(subpath)
if subpath.isabs():
- source = bytes(subpath)
+ peer_path = url = bytes(subpath)
else:
- p = urlutil.url(source)
+ p = urlutil.url(path.loc)
if p.islocal():
normpath = os.path.normpath
else:
normpath = posixpath.normpath
p.path = normpath(b'%s/%s' % (p.path, subpath))
- source = bytes(p)
- other = peer(repo, opts, source)
+ peer_path = url = bytes(p)
+ other = peer(repo, opts, peer_path)
cleanupfn = other.close
try:
- ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(source))
+ ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(url))
+ branches = (path.branch, opts.get(b'branch', []))
revs, checkout = addbranchrevs(repo, other, branches, opts.get(b'rev'))
if revs: