Commits

Angel Ezquerra  committed 0948db8

graph: only show "visible" revisions

This is necessary to be able to use the evolution extension productivelly.
Note that this is not the best way to fix this issue, but it is the simplest and
safest.

We should do a proper fix on default, using repo.filtered('visible') and
repo.changelog.revs on a for loop rather than using a while loop and increasing
the revision number one by one.

For mercurial versions earlier than 2.5 we revert to the old behavior.

Thanks to Pierre-Yves David for his help writing this patch and to Yuya for his
review.

  • Participants
  • Parent commits 3c7d9a7
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/graph.py

 import itertools
 
 from mercurial import util, error
+from mercurial import repoview
 
 def revision_grapher(repo, **opts):
     """incremental revision grapher
 
     revset = opts.get('revset', None)
     branch = opts.get('branch', None)
+    try:
+        revhidden = repoview.filterrevs(repo, 'visible')
+    except AttributeError:
+        # hg < 2.5
+        revhidden = []
     if revset:
         start_rev = max(revset)
         stop_rev = min(revset)
         follow = False
-        hidden = lambda rev: rev not in revset
+        hidden = lambda rev: (rev not in revset) or (rev in revhidden)
     else:
         start_rev = opts.get('start_rev', None)
         stop_rev = opts.get('stop_rev', 0)
         follow = opts.get('follow', False)
-        hidden = lambda rev: False
+        hidden = lambda rev: rev in revhidden
 
     assert start_rev is None or start_rev >= stop_rev