Mercurial > hg
comparison mercurial/hg.py @ 52082:42863c4ff80f stable
subrepo: move code around
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Jun 2024 14:35:52 +0200 |
parents | c1b6b8b03e48 |
children | c53b6498ed1a |
comparison
equal
deleted
inserted
replaced
52031:f8c18a5a345b | 52082:42863c4ff80f |
---|---|
1418 return _incoming( | 1418 return _incoming( |
1419 display, subreporecurse, ui, repo, source, opts, subpath=subpath | 1419 display, subreporecurse, ui, repo, source, opts, subpath=subpath |
1420 ) | 1420 ) |
1421 | 1421 |
1422 | 1422 |
1423 def _outgoing(ui, repo, dests, opts, subpath=None): | |
1424 out = set() | |
1425 others = [] | |
1426 for path in urlutil.get_push_paths(repo, ui, dests): | |
1427 dest = path.loc | |
1428 if subpath is not None: | |
1429 subpath = urlutil.url(subpath) | |
1430 if subpath.isabs(): | |
1431 dest = bytes(subpath) | |
1432 else: | |
1433 p = urlutil.url(dest) | |
1434 if p.islocal(): | |
1435 normpath = os.path.normpath | |
1436 else: | |
1437 normpath = posixpath.normpath | |
1438 p.path = normpath(b'%s/%s' % (p.path, subpath)) | |
1439 dest = bytes(p) | |
1440 branches = path.branch, opts.get(b'branch') or [] | |
1441 | |
1442 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) | |
1443 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev')) | |
1444 if revs: | |
1445 revs = [repo[rev].node() for rev in logcmdutil.revrange(repo, revs)] | |
1446 | |
1447 other = peer(repo, opts, dest) | |
1448 try: | |
1449 outgoing = discovery.findcommonoutgoing( | |
1450 repo, other, revs, force=opts.get(b'force') | |
1451 ) | |
1452 o = outgoing.missing | |
1453 out.update(o) | |
1454 if not o: | |
1455 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) | |
1456 others.append(other) | |
1457 except: # re-raises | |
1458 other.close() | |
1459 raise | |
1460 # make sure this is ordered by revision number | |
1461 outgoing_revs = list(out) | |
1462 cl = repo.changelog | |
1463 outgoing_revs.sort(key=cl.rev) | |
1464 return outgoing_revs, others | |
1465 | |
1466 | |
1467 def _outgoing_recurse(ui, repo, dests, opts): | |
1468 ret = 1 | |
1469 if opts.get(b'subrepos'): | |
1470 ctx = repo[None] | |
1471 for subpath in sorted(ctx.substate): | |
1472 sub = ctx.sub(subpath) | |
1473 ret = min(ret, sub.outgoing(ui, dests, opts)) | |
1474 return ret | |
1475 | |
1476 | |
1477 def _outgoing_filter(repo, revs, opts): | 1423 def _outgoing_filter(repo, revs, opts): |
1478 """apply revision filtering/ordering option for outgoing""" | 1424 """apply revision filtering/ordering option for outgoing""" |
1479 limit = logcmdutil.getlimit(opts) | 1425 limit = logcmdutil.getlimit(opts) |
1480 no_merges = opts.get(b'no_merges') | 1426 no_merges = opts.get(b'no_merges') |
1481 if opts.get(b'newest_first'): | 1427 if opts.get(b'newest_first'): |
1493 parents = [p for p in cl.parents(n) if p != repo.nullid] | 1439 parents = [p for p in cl.parents(n) if p != repo.nullid] |
1494 if no_merges and len(parents) == 2: | 1440 if no_merges and len(parents) == 2: |
1495 continue | 1441 continue |
1496 count += 1 | 1442 count += 1 |
1497 yield n | 1443 yield n |
1444 | |
1445 | |
1446 def _outgoing_recurse(ui, repo, dests, opts): | |
1447 ret = 1 | |
1448 if opts.get(b'subrepos'): | |
1449 ctx = repo[None] | |
1450 for subpath in sorted(ctx.substate): | |
1451 sub = ctx.sub(subpath) | |
1452 ret = min(ret, sub.outgoing(ui, dests, opts)) | |
1453 return ret | |
1498 | 1454 |
1499 | 1455 |
1500 def outgoing(ui, repo, dests, opts, subpath=None): | 1456 def outgoing(ui, repo, dests, opts, subpath=None): |
1501 if opts.get(b'graph'): | 1457 if opts.get(b'graph'): |
1502 logcmdutil.checkunsupportedgraphflags([], opts) | 1458 logcmdutil.checkunsupportedgraphflags([], opts) |
1528 finally: | 1484 finally: |
1529 for oth in others: | 1485 for oth in others: |
1530 oth.close() | 1486 oth.close() |
1531 | 1487 |
1532 | 1488 |
1489 def _outgoing(ui, repo, dests, opts, subpath=None): | |
1490 out = set() | |
1491 others = [] | |
1492 for path in urlutil.get_push_paths(repo, ui, dests): | |
1493 dest = path.loc | |
1494 if subpath is not None: | |
1495 subpath = urlutil.url(subpath) | |
1496 if subpath.isabs(): | |
1497 dest = bytes(subpath) | |
1498 else: | |
1499 p = urlutil.url(dest) | |
1500 if p.islocal(): | |
1501 normpath = os.path.normpath | |
1502 else: | |
1503 normpath = posixpath.normpath | |
1504 p.path = normpath(b'%s/%s' % (p.path, subpath)) | |
1505 dest = bytes(p) | |
1506 branches = path.branch, opts.get(b'branch') or [] | |
1507 | |
1508 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) | |
1509 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev')) | |
1510 if revs: | |
1511 revs = [repo[rev].node() for rev in logcmdutil.revrange(repo, revs)] | |
1512 | |
1513 other = peer(repo, opts, dest) | |
1514 try: | |
1515 outgoing = discovery.findcommonoutgoing( | |
1516 repo, other, revs, force=opts.get(b'force') | |
1517 ) | |
1518 o = outgoing.missing | |
1519 out.update(o) | |
1520 if not o: | |
1521 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) | |
1522 others.append(other) | |
1523 except: # re-raises | |
1524 other.close() | |
1525 raise | |
1526 # make sure this is ordered by revision number | |
1527 outgoing_revs = list(out) | |
1528 cl = repo.changelog | |
1529 outgoing_revs.sort(key=cl.rev) | |
1530 return outgoing_revs, others | |
1531 | |
1532 | |
1533 def verify(repo, level=None): | 1533 def verify(repo, level=None): |
1534 """verify the consistency of a repository""" | 1534 """verify the consistency of a repository""" |
1535 ret = verifymod.verify(repo, level=level) | 1535 ret = verifymod.verify(repo, level=level) |
1536 | 1536 |
1537 # Broken subrepo references in hidden csets don't seem worth worrying about, | 1537 # Broken subrepo references in hidden csets don't seem worth worrying about, |