changeset 29771:98976e3cae57

revpair: do not optimize tree to check for odd-range spec At cc3a30ff9490, we had to optimize a parsed tree to resolve x^:y ambiguity. Since we've moved the resolution of x^:y to parse(), we no longer have to call optimize(). Therefore, (x:y) can be taken as a single expression, not an odd range expression x:y.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 06 Aug 2016 20:46:53 +0900
parents 9c51a5de76db
children 2ebd507e5ac3
files mercurial/scmutil.py tests/test-diff-change.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sat Aug 06 20:37:48 2016 +0900
+++ b/mercurial/scmutil.py	Sat Aug 06 20:46:53 2016 +0900
@@ -781,7 +781,6 @@
 
 def _pairspec(revspec):
     tree = revset.parse(revspec)
-    tree = revset.optimize(tree)  # fix up "x^:y" -> "(x^):y"
     return tree and tree[0] in ('range', 'rangepre', 'rangepost', 'rangeall')
 
 def revpair(repo, revs):
--- a/tests/test-diff-change.t	Sat Aug 06 20:37:48 2016 +0900
+++ b/tests/test-diff-change.t	Sat Aug 06 20:46:53 2016 +0900
@@ -50,6 +50,13 @@
   @@ -1,1 +1,1 @@
   -third
   +wdir
+  $ hg diff -r '(2:2)' --nodates
+  diff -r bf5ff72eb7e0 file.txt
+  --- a/file.txt
+  +++ b/file.txt
+  @@ -1,1 +1,1 @@
+  -third
+  +wdir
   $ hg diff -r 2::2 --nodates
   diff -r bf5ff72eb7e0 file.txt
   --- a/file.txt