comparison mercurial/hg.py @ 49718:e64b1e9f4892

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 01 Dec 2022 18:19:08 +0100
parents aa36771ef505
children 5f36784c300f
comparison
equal deleted inserted replaced
49717:f2f4ec857f78 49718:e64b1e9f4892
1309 if len(srcs) != 1: 1309 if len(srcs) != 1:
1310 msg = _(b'for now, incoming supports only a single source, %d provided') 1310 msg = _(b'for now, incoming supports only a single source, %d provided')
1311 msg %= len(srcs) 1311 msg %= len(srcs)
1312 raise error.Abort(msg) 1312 raise error.Abort(msg)
1313 path = srcs[0] 1313 path = srcs[0]
1314 source, branches = urlutil.parseurl(path.rawloc, opts.get(b'branch')) 1314 if subpath is None:
1315 if subpath is not None: 1315 peer_path = path
1316 url = path.loc
1317 else:
1318 # XXX path: we are losing the `path` object here. Keeping it would be
1319 # valuable. For example as a "variant" as we do for pushes.
1316 subpath = urlutil.url(subpath) 1320 subpath = urlutil.url(subpath)
1317 if subpath.isabs(): 1321 if subpath.isabs():
1318 source = bytes(subpath) 1322 peer_path = url = bytes(subpath)
1319 else: 1323 else:
1320 p = urlutil.url(source) 1324 p = urlutil.url(path.loc)
1321 if p.islocal(): 1325 if p.islocal():
1322 normpath = os.path.normpath 1326 normpath = os.path.normpath
1323 else: 1327 else:
1324 normpath = posixpath.normpath 1328 normpath = posixpath.normpath
1325 p.path = normpath(b'%s/%s' % (p.path, subpath)) 1329 p.path = normpath(b'%s/%s' % (p.path, subpath))
1326 source = bytes(p) 1330 peer_path = url = bytes(p)
1327 other = peer(repo, opts, source) 1331 other = peer(repo, opts, peer_path)
1328 cleanupfn = other.close 1332 cleanupfn = other.close
1329 try: 1333 try:
1330 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(source)) 1334 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(url))
1335 branches = (path.branch, opts.get(b'branch', []))
1331 revs, checkout = addbranchrevs(repo, other, branches, opts.get(b'rev')) 1336 revs, checkout = addbranchrevs(repo, other, branches, opts.get(b'rev'))
1332 1337
1333 if revs: 1338 if revs:
1334 revs = [other.lookup(rev) for rev in revs] 1339 revs = [other.lookup(rev) for rev in revs]
1335 other, chlist, cleanupfn = bundlerepo.getremotechanges( 1340 other, chlist, cleanupfn = bundlerepo.getremotechanges(