##// END OF EJS Templates
cmdutil: make getgraphlogrevs limit-aware...
Siddharth Agarwal -
r18172:e6c5e009 default
parent child Browse files
Show More
@@ -1401,6 +1401,7 b' def getgraphlogrevs(repo, pats, opts):'
1401 """
1401 """
1402 if not len(repo):
1402 if not len(repo):
1403 return [], None, None
1403 return [], None, None
1404 limit = loglimit(opts)
1404 # Default --rev value depends on --follow but --follow behaviour
1405 # Default --rev value depends on --follow but --follow behaviour
1405 # depends on revisions resolved from --rev...
1406 # depends on revisions resolved from --rev...
1406 follow = opts.get('follow') or opts.get('follow_first')
1407 follow = opts.get('follow') or opts.get('follow_first')
@@ -1435,7 +1436,22 b' def getgraphlogrevs(repo, pats, opts):'
1435 # --hidden is still experimental and not worth a dedicated revset
1436 # --hidden is still experimental and not worth a dedicated revset
1436 # yet. Fortunately, filtering revision number is fast.
1437 # yet. Fortunately, filtering revision number is fast.
1437 hiddenrevs = repo.hiddenrevs
1438 hiddenrevs = repo.hiddenrevs
1438 revs = [r for r in revs if r not in hiddenrevs]
1439 nrevs = []
1440 taken = 0
1441 if limit is not None:
1442 for i in xrange(len(revs)):
1443 if taken >= limit:
1444 break
1445 r = revs[i]
1446 if r not in hiddenrevs:
1447 nrevs.append(r)
1448 taken += 1
1449 revs = nrevs
1450 else:
1451 revs = [r for r in revs if r not in hiddenrevs]
1452 elif limit is not None:
1453 revs = revs[:limit]
1454
1439 return revs, expr, filematcher
1455 return revs, expr, filematcher
1440
1456
1441 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
1457 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
@@ -1470,9 +1486,6 b' def displaygraph(ui, dag, displayer, sho'
1470 def graphlog(ui, repo, *pats, **opts):
1486 def graphlog(ui, repo, *pats, **opts):
1471 # Parameters are identical to log command ones
1487 # Parameters are identical to log command ones
1472 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
1488 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
1473 limit = loglimit(opts)
1474 if limit is not None:
1475 revs = revs[:limit]
1476 revdag = graphmod.dagwalker(repo, revs)
1489 revdag = graphmod.dagwalker(repo, revs)
1477
1490
1478 getrenamed = None
1491 getrenamed = None
General Comments 0
You need to be logged in to leave comments. Login now