changeset 20714:41e1064486f9

revset: optimized sort method in lazyset class We are taking advantage of the smartset classes sort method when it exists and converting the set to a baseset otherwise.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 06 Mar 2014 09:41:47 -0800
parents 6a1a4c212d50
children fa1ac5faa7c4
files mercurial/revset.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Mar 13 13:47:21 2014 -0700
+++ b/mercurial/revset.py	Thu Mar 06 09:41:47 2014 -0800
@@ -2253,8 +2253,8 @@
         return l[x]
 
     def sort(self, reverse=False):
-        # Basic implementation to be changed in future patches.
-        self._subset = baseset(self._subset)
+        if not util.safehasattr(self._subset, 'sort'):
+            self._subset = baseset(self._subset)
         self._subset.sort(reverse=reverse)
 
     def reverse(self):