Show More
@@ -1399,34 +1399,8 b' def getgraphlogrevs(repo, pats, opts):' | |||
|
1399 | 1399 | callable taking a revision number and returning a match objects |
|
1400 | 1400 | filtering the files to be detailed when displaying the revision. |
|
1401 | 1401 | """ |
|
1402 | def increasingrevs(repo, revs, matcher): | |
|
1403 | # The sorted input rev sequence is chopped in sub-sequences | |
|
1404 | # which are sorted in ascending order and passed to the | |
|
1405 | # matcher. The filtered revs are sorted again as they were in | |
|
1406 | # the original sub-sequence. This achieve several things: | |
|
1407 | # | |
|
1408 | # - getlogrevs() now returns a generator which behaviour is | |
|
1409 | # adapted to log need. First results come fast, last ones | |
|
1410 | # are batched for performances. | |
|
1411 | # | |
|
1412 | # - revset matchers often operate faster on revision in | |
|
1413 | # changelog order, because most filters deal with the | |
|
1414 | # changelog. | |
|
1415 | # | |
|
1416 | # - revset matchers can reorder revisions. "A or B" typically | |
|
1417 | # returns returns the revision matching A then the revision | |
|
1418 | # matching B. We want to hide this internal implementation | |
|
1419 | # detail from the caller, and sorting the filtered revision | |
|
1420 | # again achieves this. | |
|
1421 | for i, window in increasingwindows(0, len(revs), windowsize=1): | |
|
1422 | orevs = revs[i:i + window] | |
|
1423 | nrevs = set(matcher(repo, sorted(orevs))) | |
|
1424 | for rev in orevs: | |
|
1425 | if rev in nrevs: | |
|
1426 | yield rev | |
|
1427 | ||
|
1428 | 1402 | if not len(repo): |
|
1429 |
return |
|
|
1403 | return [], None, None | |
|
1430 | 1404 | # Default --rev value depends on --follow but --follow behaviour |
|
1431 | 1405 | # depends on revisions resolved from --rev... |
|
1432 | 1406 | follow = opts.get('follow') or opts.get('follow_first') |
@@ -1443,20 +1417,25 b' def getgraphlogrevs(repo, pats, opts):' | |||
|
1443 | 1417 | revs = list(repo.changelog) |
|
1444 | 1418 | revs.reverse() |
|
1445 | 1419 | if not revs: |
|
1446 |
return |
|
|
1420 | return [], None, None | |
|
1447 | 1421 | expr, filematcher = _makegraphlogrevset(repo, pats, opts, revs) |
|
1448 | 1422 | if possiblyunsorted: |
|
1449 | 1423 | revs.sort(reverse=True) |
|
1450 | 1424 | if expr: |
|
1425 | # Revset matchers often operate faster on revisions in changelog | |
|
1426 | # order, because most filters deal with the changelog. | |
|
1427 | revs.reverse() | |
|
1451 | 1428 | matcher = revset.match(repo.ui, expr) |
|
1452 | revs = increasingrevs(repo, revs, matcher) | |
|
1429 | # Revset matches can reorder revisions. "A or B" typically returns | |
|
1430 | # returns the revision matching A then the revision matching B. Sort | |
|
1431 | # again to fix that. | |
|
1432 | revs = matcher(repo, revs) | |
|
1433 | revs.sort(reverse=True) | |
|
1453 | 1434 | if not opts.get('hidden'): |
|
1454 | 1435 | # --hidden is still experimental and not worth a dedicated revset |
|
1455 | 1436 | # yet. Fortunately, filtering revision number is fast. |
|
1456 | 1437 | hiddenrevs = repo.hiddenrevs |
|
1457 |
revs = |
|
|
1458 | else: | |
|
1459 | revs = iter(revs) | |
|
1438 | revs = [r for r in revs if r not in hiddenrevs] | |
|
1460 | 1439 | return revs, expr, filematcher |
|
1461 | 1440 | |
|
1462 | 1441 | def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None, |
@@ -1491,7 +1470,6 b' def displaygraph(ui, dag, displayer, sho' | |||
|
1491 | 1470 | def graphlog(ui, repo, *pats, **opts): |
|
1492 | 1471 | # Parameters are identical to log command ones |
|
1493 | 1472 | revs, expr, filematcher = getgraphlogrevs(repo, pats, opts) |
|
1494 | revs = sorted(revs, reverse=1) | |
|
1495 | 1473 | limit = loglimit(opts) |
|
1496 | 1474 | if limit is not None: |
|
1497 | 1475 | revs = revs[:limit] |
General Comments 0
You need to be logged in to leave comments.
Login now