From patchwork Mon Aug 8 15:25:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,5] revpair: do not optimize tree to check for odd-range spec From: Yuya Nishihara X-Patchwork-Id: 16202 Message-Id: <61c8a67750ead0434765.1470669924@mimosa> To: mercurial-devel@mercurial-scm.org Date: Tue, 09 Aug 2016 00:25:24 +0900 # HG changeset patch # User Yuya Nishihara # Date 1470484013 -32400 # Sat Aug 06 20:46:53 2016 +0900 # Node ID 61c8a67750ead0434765c0ad38de895e4fa86539 # Parent ba93a75f774fbbaa07bef5327e4f8c43755f42cd 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. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -781,7 +781,6 @@ def revsingle(repo, revspec, default='.' 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): diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t --- a/tests/test-diff-change.t +++ b/tests/test-diff-change.t @@ -50,6 +50,13 @@ as pairs even if x == y, but not for "f( @@ -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