changeset 20719:cce8fbedc82a

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.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 13 Mar 2014 17:15:21 -0700
parents d7b7ec0459c6
children 5f8400efca0b
files mercurial/revset.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: