revpair: do not optimize tree to check for odd-range spec
authorYuya Nishihara <yuya@tcha.org>
Sat, 06 Aug 2016 20:46:53 +0900
changeset 29771 98976e3cae57
parent 29770 9c51a5de76db
child 29772 2ebd507e5ac3
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.
mercurial/scmutil.py
tests/test-diff-change.t
--- 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