revset: changed sort method to use native sort implementation of smartsets
authorLucas Moscovicz <lmoscovicz@fb.com>
Thu, 13 Mar 2014 17:15:21 -0700
changeset 20719 cce8fbedc82a
parent 20718 d7b7ec0459c6
child 20720 5f8400efca0b
revset: changed sort method to use native sort implementation of smartsets When sort is done by revision or reversed revision number it can just call sort on the set and doesn't have to iterate it all over again.
mercurial/revset.py
--- a/mercurial/revset.py	Thu Mar 13 17:16:58 2014 -0700
+++ b/mercurial/revset.py	Thu Mar 13 17:15:21 2014 -0700
@@ -1492,7 +1492,14 @@
     l = []
     def invert(s):
         return "".join(chr(255 - ord(c)) for c in s)
-    for r in getset(repo, subset, s):
+    revs = getset(repo, subset, s)
+    if keys == ["rev"]:
+        revs.sort()
+        return revs
+    elif keys == ["-rev"]:
+        revs.sort(reverse=True)
+        return revs
+    for r in revs:
         c = repo[r]
         e = []
         for k in keys: