Commits

Yuya Nishihara committed be009bb

graph: fix compatibility layer for repoview.filterrevs()

repoview module does not exist in Mercurial 2.4.x.

  • Participants
  • Parent commits 0948db8
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/graph.py

 import itertools
 
 from mercurial import util, error
-from mercurial import repoview
+
+try:
+    from mercurial import repoview
+    _filterrevs = repoview.filterrevs
+except ImportError: # hg < 2.5
+    def _filterrevs(repo, filtername):
+        return []
 
 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 = []
+    revhidden = _filterrevs(repo, 'visible')
     if revset:
         start_rev = max(revset)
         stop_rev = min(revset)