# HG changeset patch # User Lucas Moscovicz # Date 2014-03-14 00:15:21 # Node ID cce8fbedc82a284d4c5159fced20e095c2e799d4 # Parent d7b7ec0459c6f42ce3f1c24c42f83f2858b9e805 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1492,7 +1492,14 @@ def sort(repo, subset, x): 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: