comparison tests/test-diff-change.t @ 26020:cc3a30ff9490

revpair: restrict odd-range handling to top-level x:y expression (issue4774) The odd-range hack was introduced by 2a0efa1112ac for backward compatibility, but it was too widely applied. I've checked cmdutil.revpair() at 1.6, and found that ".:", ":0" and ":" are also handled as pairs. So let's enable the hack only for "x:y", "x:", "y:" and ":". test-revset.t is updated because "tip^::tip^ or tip^" shouldn't be taken as an odd range. This patch adds "tip^:tip^" instead. This patch is written for the default branch because parse() of the stable branch lacks compatibility hack for "foo+bar" tag. If we want to mitigate the issue in stable, we can add something like "and '::' in revs[0]".
author Yuya Nishihara <yuya@tcha.org>
date Thu, 13 Aug 2015 16:15:43 +0900
parents 85f5352c7ca7
children 98976e3cae57
comparison
equal deleted inserted replaced
26019:85f5352c7ca7 26020:cc3a30ff9490
29 -first 29 -first
30 +second 30 +second
31 31
32 $ cd .. 32 $ cd ..
33 33
34 Test dumb revspecs (issue3474) 34 Test dumb revspecs: top-level "x:y", "x:", ":y" and ":" ranges should be handled
35 as pairs even if x == y, but not for "f(x:y)" nor "x::y" (issue3474, issue4774)
35 36
36 $ hg clone -q a dumbspec 37 $ hg clone -q a dumbspec
37 $ cd dumbspec 38 $ cd dumbspec
38 $ echo "wdir" > file.txt 39 $ echo "wdir" > file.txt
39 40
40 $ hg diff -r 2:2 41 $ hg diff -r 2:2
42 $ hg diff -r 2:.
43 $ hg diff -r 2:
44 $ hg diff -r :0
45 $ hg diff -r '2:first(2:2)'
46 $ hg diff -r 'first(2:2)' --nodates
47 diff -r bf5ff72eb7e0 file.txt
48 --- a/file.txt
49 +++ b/file.txt
50 @@ -1,1 +1,1 @@
51 -third
52 +wdir
53 $ hg diff -r 2::2 --nodates
54 diff -r bf5ff72eb7e0 file.txt
55 --- a/file.txt
56 +++ b/file.txt
57 @@ -1,1 +1,1 @@
58 -third
59 +wdir
41 $ hg diff -r "2 and 1" 60 $ hg diff -r "2 and 1"
42 abort: empty revision range 61 abort: empty revision range
43 [255] 62 [255]
63
64 $ cd ..
65
66 $ hg clone -qr0 a dumbspec-rev0
67 $ cd dumbspec-rev0
68 $ echo "wdir" > file.txt
69
70 $ hg diff -r :
71 $ hg diff -r 'first(:)' --nodates
72 diff -r 4bb65dda5db4 file.txt
73 --- a/file.txt
74 +++ b/file.txt
75 @@ -1,1 +1,1 @@
76 -first
77 +wdir
44 78
45 $ cd .. 79 $ cd ..
46 80
47 Testing diff --change when merge: 81 Testing diff --change when merge:
48 82