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 _no_subtoppath = object() |
|
1424 |
|
1425 |
1423 def _outgoing(ui, repo, dests, opts, subpath=None): |
1426 def _outgoing(ui, repo, dests, opts, subpath=None): |
1424 out = set() |
1427 out = set() |
1425 others = [] |
1428 others = [] |
1426 for path in urlutil.get_push_paths(repo, ui, dests): |
1429 for path in urlutil.get_push_paths(repo, ui, dests): |
1427 dest = path.loc |
1430 dest = path.loc |
1428 repo._subtoppath = dest |
1431 prev_subtopath = getattr(repo, "_subtoppath", _no_subtoppath) |
1429 if subpath is not None: |
1432 try: |
1430 subpath = urlutil.url(subpath) |
1433 repo._subtoppath = dest |
1431 if subpath.isabs(): |
1434 if subpath is not None: |
1432 dest = bytes(subpath) |
1435 subpath = urlutil.url(subpath) |
|
1436 if subpath.isabs(): |
|
1437 dest = bytes(subpath) |
|
1438 else: |
|
1439 p = urlutil.url(dest) |
|
1440 if p.islocal(): |
|
1441 normpath = os.path.normpath |
|
1442 else: |
|
1443 normpath = posixpath.normpath |
|
1444 p.path = normpath(b'%s/%s' % (p.path, subpath)) |
|
1445 dest = bytes(p) |
|
1446 branches = path.branch, opts.get(b'branch') or [] |
|
1447 |
|
1448 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) |
|
1449 revs, checkout = addbranchrevs( |
|
1450 repo, repo, branches, opts.get(b'rev') |
|
1451 ) |
|
1452 if revs: |
|
1453 revs = [ |
|
1454 repo[rev].node() for rev in logcmdutil.revrange(repo, revs) |
|
1455 ] |
|
1456 |
|
1457 other = peer(repo, opts, dest) |
|
1458 try: |
|
1459 outgoing = discovery.findcommonoutgoing( |
|
1460 repo, other, revs, force=opts.get(b'force') |
|
1461 ) |
|
1462 o = outgoing.missing |
|
1463 out.update(o) |
|
1464 if not o: |
|
1465 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) |
|
1466 others.append(other) |
|
1467 except: # re-raises |
|
1468 other.close() |
|
1469 raise |
|
1470 finally: |
|
1471 if prev_subtopath is _no_subtoppath: |
|
1472 del repo._subtoppath |
1433 else: |
1473 else: |
1434 p = urlutil.url(dest) |
1474 repo._subtoppath = prev_subtopath |
1435 if p.islocal(): |
|
1436 normpath = os.path.normpath |
|
1437 else: |
|
1438 normpath = posixpath.normpath |
|
1439 p.path = normpath(b'%s/%s' % (p.path, subpath)) |
|
1440 dest = bytes(p) |
|
1441 branches = path.branch, opts.get(b'branch') or [] |
|
1442 |
|
1443 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) |
|
1444 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev')) |
|
1445 if revs: |
|
1446 revs = [repo[rev].node() for rev in logcmdutil.revrange(repo, revs)] |
|
1447 |
|
1448 other = peer(repo, opts, dest) |
|
1449 try: |
|
1450 outgoing = discovery.findcommonoutgoing( |
|
1451 repo, other, revs, force=opts.get(b'force') |
|
1452 ) |
|
1453 o = outgoing.missing |
|
1454 out.update(o) |
|
1455 if not o: |
|
1456 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) |
|
1457 others.append(other) |
|
1458 except: # re-raises |
|
1459 other.close() |
|
1460 raise |
|
1461 # make sure this is ordered by revision number |
1475 # make sure this is ordered by revision number |
1462 outgoing_revs = list(out) |
1476 outgoing_revs = list(out) |
1463 cl = repo.changelog |
1477 cl = repo.changelog |
1464 outgoing_revs.sort(key=cl.rev) |
1478 outgoing_revs.sort(key=cl.rev) |
1465 return outgoing_revs, others |
1479 return outgoing_revs, others |
1527 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts)) |
1541 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts)) |
1528 return ret # exit code is zero since we found outgoing changes |
1542 return ret # exit code is zero since we found outgoing changes |
1529 finally: |
1543 finally: |
1530 for oth in others: |
1544 for oth in others: |
1531 oth.close() |
1545 oth.close() |
1532 del repo._subtoppath |
|
1533 |
1546 |
1534 |
1547 |
1535 def verify(repo, level=None): |
1548 def verify(repo, level=None): |
1536 """verify the consistency of a repository""" |
1549 """verify the consistency of a repository""" |
1537 ret = verifymod.verify(repo, level=level) |
1550 ret = verifymod.verify(repo, level=level) |