Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 52082:fb15ba66c702 stable
subrepo: propagate non-default path on outgoing
There was already a fix made in 5dbff89cf107 for pull and push commands. I did
the same for the outgoing command.
The problem I identified is that when the parent repository has multiple paths,
the outgoing command was not respecting the parent path used and was always
using the default path for subrepositories.
author | Felipe Resende <felipe@fcresende.dev.br> |
---|---|
date | Sun, 31 Mar 2024 17:57:46 -0300 |
parents | 653b7a19f1de |
children | 19ae7730636a |
comparison
equal
deleted
inserted
replaced
52081:653b7a19f1de | 52082:fb15ba66c702 |
---|---|
1470 for n in _outgoing_filter(repo, o, opts): | 1470 for n in _outgoing_filter(repo, o, opts): |
1471 displayer.show(repo[n]) | 1471 displayer.show(repo[n]) |
1472 displayer.close() | 1472 displayer.close() |
1473 | 1473 |
1474 | 1474 |
1475 _no_subtoppath = object() | |
1476 | |
1477 | |
1475 def outgoing(ui, repo, dests, opts, subpath=None): | 1478 def outgoing(ui, repo, dests, opts, subpath=None): |
1476 if opts.get(b'graph'): | 1479 if opts.get(b'graph'): |
1477 logcmdutil.checkunsupportedgraphflags([], opts) | 1480 logcmdutil.checkunsupportedgraphflags([], opts) |
1478 o, others = _outgoing(ui, repo, dests, opts, subpath=subpath) | |
1479 ret = 1 | 1481 ret = 1 |
1480 try: | |
1481 if o: | |
1482 ret = 0 | |
1483 display_outgoing_revs(ui, repo, o, opts) | |
1484 for oth in others: | |
1485 cmdutil.outgoinghooks(ui, repo, oth, opts, o) | |
1486 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts)) | |
1487 return ret # exit code is zero since we found outgoing changes | |
1488 finally: | |
1489 for oth in others: | |
1490 oth.close() | |
1491 | |
1492 | |
1493 def _outgoing(ui, repo, dests, opts, subpath=None): | |
1494 out = set() | |
1495 others = [] | |
1496 for path in urlutil.get_push_paths(repo, ui, dests): | 1482 for path in urlutil.get_push_paths(repo, ui, dests): |
1497 dest = path.loc | 1483 dest = path.loc |
1498 if True: | 1484 prev_subtopath = getattr(repo, "_subtoppath", _no_subtoppath) |
1485 try: | |
1486 repo._subtoppath = dest | |
1499 if subpath is not None: | 1487 if subpath is not None: |
1500 subpath = urlutil.url(subpath) | 1488 subpath = urlutil.url(subpath) |
1501 if subpath.isabs(): | 1489 if subpath.isabs(): |
1502 dest = bytes(subpath) | 1490 dest = bytes(subpath) |
1503 else: | 1491 else: |
1523 try: | 1511 try: |
1524 outgoing = discovery.findcommonoutgoing( | 1512 outgoing = discovery.findcommonoutgoing( |
1525 repo, other, revs, force=opts.get(b'force') | 1513 repo, other, revs, force=opts.get(b'force') |
1526 ) | 1514 ) |
1527 o = outgoing.missing | 1515 o = outgoing.missing |
1528 out.update(o) | |
1529 if not o: | 1516 if not o: |
1530 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) | 1517 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) |
1531 others.append(other) | 1518 else: |
1519 ret = 0 | |
1520 display_outgoing_revs(ui, repo, o, opts) | |
1521 | |
1522 cmdutil.outgoinghooks(ui, repo, other, opts, o) | |
1523 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts)) | |
1532 except: # re-raises | 1524 except: # re-raises |
1525 raise | |
1526 finally: | |
1533 other.close() | 1527 other.close() |
1534 raise | 1528 finally: |
1535 return list(out), others | 1529 if prev_subtopath is _no_subtoppath: |
1530 del repo._subtoppath | |
1531 else: | |
1532 repo._subtoppath = prev_subtopath | |
1533 return ret | |
1536 | 1534 |
1537 | 1535 |
1538 def verify(repo, level=None): | 1536 def verify(repo, level=None): |
1539 """verify the consistency of a repository""" | 1537 """verify the consistency of a repository""" |
1540 ret = verifymod.verify(repo, level=level) | 1538 ret = verifymod.verify(repo, level=level) |