changeset 1547:910f56f0d09c

revset: make "fromsvn()" lazy "fromsvn()" could be a huge revset. Therefore a lazy version makes more sense. This also resolves a subtle ordering issue. See https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-August/103368.html for the context.
author Jun Wu <quark@fb.com>
date Tue, 19 Dec 2017 14:18:01 -0800
parents ddfd60760fac
children 7f83be82d03f
files hgsubversion/util.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -348,17 +348,13 @@ def revset_fromsvn(repo, subset, x):
     '''
     args = revset.getargs(x, 0, 0, "fromsvn takes no arguments")
 
-    rev = repo.changelog.rev
-    bin = node.bin
     meta = repo.svnmeta(skiperrorcheck=True)
     if not meta.revmapexists:
         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())
-    filteredrevs = filter(svnrevs.__contains__, subset)
-    if smartset is not None:
-        filteredrevs = smartset.baseset(filteredrevs)
-    return filteredrevs
+    tonode = repo.changelog.node
+    hashes = meta.revmap.hashes()
+    return subset.filter(lambda r: tonode(r) in hashes)
 
 def revset_svnrev(repo, subset, x):
     '''``svnrev(number)``