mercurial/stack.py
changeset 37004 68fcc5503ec5
parent 37000 40583c7afd63
child 42698 77c52ce50e6a
--- a/mercurial/stack.py	Fri Jan 19 17:09:24 2018 +0100
+++ b/mercurial/stack.py	Fri Jan 19 17:29:50 2018 +0100
@@ -13,8 +13,8 @@
 )
 
 def getstack(repo, rev=None):
-    """return a smartrev of the stack containing either rev if it is not None
-    or the current working directory parent.
+    """return a sorted smartrev of the stack containing either rev if it is
+    not None or the current working directory parent.
 
     The stack will always contain all drafts changesets which are ancestors to
     the revision and are not merges.
@@ -24,4 +24,6 @@
 
     revspec = 'reverse(only(%s) and not public() and not ::merge())'
     revset = revsetlang.formatspec(revspec, rev)
-    return scmutil.revrange(repo, [revset])
+    revisions = scmutil.revrange(repo, [revset])
+    revisions.sort()
+    return revisions