# HG changeset patch # User Lucas Moscovicz # Date 2014-03-06 17:41:47 # Node ID 41e1064486f96bd2761acf85e197e627346c292e # Parent 6a1a4c212d50b761c9abffabbd988d68aa95f607 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2253,8 +2253,8 @@ class lazyset(object): 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):