Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hg.py @ 46930:0afe96e374a7
outgoing: pass subrepo path using function argument instead of abssource hack
This is clearer, remove the needs for the `repo._subtoppath` hack and will make
our live easier when making `outgoing` accept multiple destinations.
Differential Revision: https://phab.mercurial-scm.org/D10390
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 15 Apr 2021 09:23:28 +0200 |
parents | efc6f6a794bd |
children | d4e4ccb75f99 |
comparison
equal
deleted
inserted
replaced
46929:5a59a0ed0a37 | 46930:0afe96e374a7 |
---|---|
1318 displayer.show(other[n]) | 1318 displayer.show(other[n]) |
1319 | 1319 |
1320 return _incoming(display, subreporecurse, ui, repo, source, opts) | 1320 return _incoming(display, subreporecurse, ui, repo, source, opts) |
1321 | 1321 |
1322 | 1322 |
1323 def _outgoing(ui, repo, dest, opts): | 1323 def _outgoing(ui, repo, dest, opts, subpath=None): |
1324 path = ui.getpath(dest, default=(b'default-push', b'default')) | 1324 path = ui.getpath(dest, default=(b'default-push', b'default')) |
1325 if not path: | 1325 if not path: |
1326 raise error.Abort( | 1326 raise error.Abort( |
1327 _(b'default repository not configured!'), | 1327 _(b'default repository not configured!'), |
1328 hint=_(b"see 'hg help config.paths'"), | 1328 hint=_(b"see 'hg help config.paths'"), |
1329 ) | 1329 ) |
1330 dest = path.pushloc or path.loc | 1330 dest = path.pushloc or path.loc |
1331 if subpath is not None: | |
1332 subpath = urlutil.url(subpath) | |
1333 if subpath.isabs(): | |
1334 dest = bytes(subpath) | |
1335 else: | |
1336 p = urlutil.url(dest) | |
1337 p.path = os.path.normpath(b'%s/%s' % (p.path, subpath)) | |
1338 dest = bytes(p) | |
1339 | |
1331 branches = path.branch, opts.get(b'branch') or [] | 1340 branches = path.branch, opts.get(b'branch') or [] |
1332 | 1341 |
1333 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) | 1342 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) |
1334 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev')) | 1343 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev')) |
1335 if revs: | 1344 if revs: |
1380 continue | 1389 continue |
1381 count += 1 | 1390 count += 1 |
1382 yield n | 1391 yield n |
1383 | 1392 |
1384 | 1393 |
1385 def outgoing(ui, repo, dest, opts): | 1394 def outgoing(ui, repo, dest, opts, subpath=None): |
1386 if opts.get(b'graph'): | 1395 if opts.get(b'graph'): |
1387 logcmdutil.checkunsupportedgraphflags([], opts) | 1396 logcmdutil.checkunsupportedgraphflags([], opts) |
1388 o, other = _outgoing(ui, repo, dest, opts) | 1397 o, other = _outgoing(ui, repo, dest, opts, subpath=subpath) |
1389 ret = 1 | 1398 ret = 1 |
1390 try: | 1399 try: |
1391 if o: | 1400 if o: |
1392 ret = 0 | 1401 ret = 0 |
1393 | 1402 |