changeset 1502:fb91566d849c

util: return baseset instead of plain list from revset Support for returning plain lists from revset predicates was recently removed. (See: https://www.mercurial-scm.org/repo/hg/rev/35b8bb1ef02b)
author Arun Kulshreshtha <kulshrax@fb.com>
date Fri, 21 Apr 2017 13:43:59 -0700
parents 6e3f48d8002f
children 180e0d5fba2e
files hgsubversion/util.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -23,6 +23,12 @@ try:
 except ImportError:
     pass
 
+try:
+    from mercurial import smartset
+    smartset.baseset # force demandimport to load the module now
+except ImportError:
+    smartset = None
+
 import maps
 
 ignoredfiles = set(['.hgtags', '.hgsvnexternals', '.hgsub', '.hgsubstate'])
@@ -345,7 +351,10 @@ def revset_fromsvn(repo, subset, x):
         raise hgutil.Abort("svn metadata is missing - "
                            "run 'hg svn rebuildmeta' to reconstruct it")
     svnrevs = set(rev(h) for h in meta.revmap.hashes().keys())
-    return filter(svnrevs.__contains__, subset)
+    filteredrevs = filter(svnrevs.__contains__, subset)
+    if smartset is not None:
+        filteredrevs = smartset.baseset(filteredrevs)
+    return filteredrevs
 
 def revset_svnrev(repo, subset, x):
     '''``svnrev(number)``
@@ -369,6 +378,8 @@ def revset_svnrev(repo, subset, x):
         r = repo[n].rev()
         if r in subset:
             revs.append(r)
+    if smartset is not None:
+        revs = smartset.baseset(revs)
     return revs
 
 revsets = {