mq: use `revs.sort()` to ensure the set is ascending
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 07 Oct 2014 00:12:56 -0700
changeset 22803 31a591c3fecc
parent 22802 1fcd361efaf4
child 22804 5385314e0b14
mq: use `revs.sort()` to ensure the set is ascending Sorting is super-cheap with the new smartset class, so we can use it to enforce the order. Otherwise all smartset classes would have to allow direct indexing.
hgext/mq.py
--- a/hgext/mq.py	Mon Oct 06 10:41:43 2014 -0700
+++ b/hgext/mq.py	Tue Oct 07 00:12:56 2014 -0700
@@ -1002,8 +1002,7 @@
             if not self.applied:
                 raise util.Abort(_('no patches applied'))
             revs = scmutil.revrange(repo, opts.get('rev'))
-            if len(revs) > 1 and revs[0] > revs[1]:
-                revs.reverse()
+            revs.sort()
             revpatches = self._revpatches(repo, revs)
             realpatches += revpatches
             numrevs = len(revpatches)