changeset 29139:64c1955a0461

revset: make dagrange preserve order of input set Unlike range, dagrange has no inverted range (such as '10:0'). So there should be no practical reason to keep dagrange as a function that forces its own ordering. No performance regression is spotted in contrib/base-revsets.txt.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 May 2016 12:36:44 +0900
parents a29f071751df
children 47eab0cb72e3
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu May 05 09:26:09 2016 +0000
+++ b/mercurial/revset.py	Tue May 03 12:36:44 2016 +0900
@@ -386,9 +386,7 @@
     r = fullreposet(repo)
     xs = reachableroots(repo, getset(repo, r, x), getset(repo, r, y),
                          includepath=True)
-    # XXX We should combine with subset first: 'subset & baseset(...)'. This is
-    # necessary to ensure we preserve the order in subset.
-    return xs & subset
+    return subset & xs
 
 def andset(repo, subset, x, y):
     return getset(repo, getset(repo, subset, x), y)
--- a/tests/test-revset.t	Thu May 05 09:26:09 2016 +0000
+++ b/tests/test-revset.t	Tue May 03 12:36:44 2016 +0900
@@ -898,6 +898,16 @@
   $ log 'tag(tip)'
   9
 
+Test order of revisions in compound expression
+----------------------------------------------
+
+ 'A & B' should follow the order of 'A':
+
+  $ log '2:0 & 0::2'
+  2
+  1
+  0
+
 test sort revset
 --------------------------------------------