diff mercurial/revset.py @ 29948:5f56a3b9675e

revset: fix order of nested 'range' expression (BC) Enforce range order only if necessary as the comment says "carrying the sorting over would be more efficient."
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 May 2016 12:52:50 +0900
parents 80c86b9bb40b
children 89dbae952ec1
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Jun 01 20:54:04 2016 +0900
+++ b/mercurial/revset.py	Tue May 03 12:52:50 2016 +0900
@@ -378,12 +378,12 @@
         r = spanset(repo, m, n + 1)
     else:
         r = spanset(repo, m, n - 1)
-    # XXX We should combine with subset first: 'subset & baseset(...)'. This is
-    # necessary to ensure we preserve the order in subset.
-    #
-    # This has performance implication, carrying the sorting over when possible
-    # would be more efficient.
-    return r & subset
+
+    if order == defineorder:
+        return r & subset
+    else:
+        # carrying the sorting over when possible would be more efficient
+        return subset & r
 
 def dagrange(repo, subset, x, y, order):
     r = fullreposet(repo)