revset: optimize stringset when subset == entire repo
authorIdan Kamara <idankk86@gmail.com>
Fri, 15 Apr 2011 20:07:44 +0300
changeset 13938 e44ebd2a142a
parent 13936 f4e4faa92939
child 13939 ed22a26fc7c6
revset: optimize stringset when subset == entire repo if range(len(repo)) is passed to stringset and x is a valid rev (checked before) then x is guaranteed to be in subset, we can check for that by comparing the lengths of the sets
mercurial/revset.py
--- a/mercurial/revset.py	Thu Apr 14 10:00:15 2011 +0200
+++ b/mercurial/revset.py	Fri Apr 15 20:07:44 2011 +0300
@@ -123,7 +123,7 @@
     x = repo[x].rev()
     if x == -1 and len(subset) == len(repo):
         return [-1]
-    if x in subset:
+    if len(subset) == len(repo) or x in subset:
         return [x]
     return []