##// END OF EJS Templates
subrepo: move code around
marmoute -
r52975:42863c4f stable
parent child Browse files
Show More
@@ -1420,6 +1420,72 def incoming(ui, repo, source, opts, sub
1420 )
1420 )
1421
1421
1422
1422
1423 def _outgoing_filter(repo, revs, opts):
1424 """apply revision filtering/ordering option for outgoing"""
1425 limit = logcmdutil.getlimit(opts)
1426 no_merges = opts.get(b'no_merges')
1427 if opts.get(b'newest_first'):
1428 revs.reverse()
1429 if limit is None and not no_merges:
1430 for r in revs:
1431 yield r
1432 return
1433
1434 count = 0
1435 cl = repo.changelog
1436 for n in revs:
1437 if limit is not None and count >= limit:
1438 break
1439 parents = [p for p in cl.parents(n) if p != repo.nullid]
1440 if no_merges and len(parents) == 2:
1441 continue
1442 count += 1
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
1454
1455
1456 def outgoing(ui, repo, dests, opts, subpath=None):
1457 if opts.get(b'graph'):
1458 logcmdutil.checkunsupportedgraphflags([], opts)
1459 o, others = _outgoing(ui, repo, dests, opts, subpath=subpath)
1460 ret = 1
1461 try:
1462 if o:
1463 ret = 0
1464
1465 if opts.get(b'graph'):
1466 revdag = logcmdutil.graphrevs(repo, o, opts)
1467 ui.pager(b'outgoing')
1468 displayer = logcmdutil.changesetdisplayer(
1469 ui, repo, opts, buffered=True
1470 )
1471 logcmdutil.displaygraph(
1472 ui, repo, revdag, displayer, graphmod.asciiedges
1473 )
1474 else:
1475 ui.pager(b'outgoing')
1476 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1477 for n in _outgoing_filter(repo, o, opts):
1478 displayer.show(repo[n])
1479 displayer.close()
1480 for oth in others:
1481 cmdutil.outgoinghooks(ui, repo, oth, opts, o)
1482 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts))
1483 return ret # exit code is zero since we found outgoing changes
1484 finally:
1485 for oth in others:
1486 oth.close()
1487
1488
1423 def _outgoing(ui, repo, dests, opts, subpath=None):
1489 def _outgoing(ui, repo, dests, opts, subpath=None):
1424 out = set()
1490 out = set()
1425 others = []
1491 others = []
@@ -1464,72 +1530,6 def _outgoing(ui, repo, dests, opts, sub
1464 return outgoing_revs, others
1530 return outgoing_revs, others
1465
1531
1466
1532
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):
1478 """apply revision filtering/ordering option for outgoing"""
1479 limit = logcmdutil.getlimit(opts)
1480 no_merges = opts.get(b'no_merges')
1481 if opts.get(b'newest_first'):
1482 revs.reverse()
1483 if limit is None and not no_merges:
1484 for r in revs:
1485 yield r
1486 return
1487
1488 count = 0
1489 cl = repo.changelog
1490 for n in revs:
1491 if limit is not None and count >= limit:
1492 break
1493 parents = [p for p in cl.parents(n) if p != repo.nullid]
1494 if no_merges and len(parents) == 2:
1495 continue
1496 count += 1
1497 yield n
1498
1499
1500 def outgoing(ui, repo, dests, opts, subpath=None):
1501 if opts.get(b'graph'):
1502 logcmdutil.checkunsupportedgraphflags([], opts)
1503 o, others = _outgoing(ui, repo, dests, opts, subpath=subpath)
1504 ret = 1
1505 try:
1506 if o:
1507 ret = 0
1508
1509 if opts.get(b'graph'):
1510 revdag = logcmdutil.graphrevs(repo, o, opts)
1511 ui.pager(b'outgoing')
1512 displayer = logcmdutil.changesetdisplayer(
1513 ui, repo, opts, buffered=True
1514 )
1515 logcmdutil.displaygraph(
1516 ui, repo, revdag, displayer, graphmod.asciiedges
1517 )
1518 else:
1519 ui.pager(b'outgoing')
1520 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1521 for n in _outgoing_filter(repo, o, opts):
1522 displayer.show(repo[n])
1523 displayer.close()
1524 for oth in others:
1525 cmdutil.outgoinghooks(ui, repo, oth, opts, o)
1526 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts))
1527 return ret # exit code is zero since we found outgoing changes
1528 finally:
1529 for oth in others:
1530 oth.close()
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)
General Comments 0
You need to be logged in to leave comments. Login now