annotate tests/test-diff-unified.t @ 15462:2b1ec74c961f stable

mdiff/patch: fix bad hunk handling for unified diffs with zero context Prior to this patch "hg diff -U0", i.e., zero lines of context, would output hunk headers with a start line one greater than what GNU patch and git output. Guido van Rossum documents the unified diff format[1] as having a start line value "one lower than one would expect" for zero length hunks. Comparing the behaviour of the three systems prior to this patch in transforming c1 c3 to c1 c2 c3 - GNU "diff -U0" reports the hunk as "@@ -1,0 +2 @@" - "git diff -U0" reports the hunk as "@@ -1,0 +2 @@" - "hg diff -U0" reports the hunk as "@@ -2,0 +2,1 @@" After this patch, "hg diff -U0" reports "@@ -1,0 +2,1 @@". Since "hg export --config diff.unified=0" outputs zero-context unified diffs, "hg import" has also been updated to account for start lines one less than expected for zero length hunk ranges. [1]: http://www.artima.com/weblogs/viewpost.jsp?thread=164293
author Nicolas Venegas <nvenegas@atlassian.com>
date Wed, 09 Nov 2011 16:55:59 -0800
parents 4134686b83e1
children 10c8110d114b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
1 $ hg init repo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
2 $ cd repo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
3 $ cat > a <<EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
4 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
5 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
6 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
7 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
8 > b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
9 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
10 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
11 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
12 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
13 > EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
14 $ hg ci -Am adda
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
15 adding a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
17 $ cat > a <<EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
18 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
19 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
20 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
21 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
22 > dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
23 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
24 > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
25 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
26 > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
27 > EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
28
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
29 default context
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
30
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
31 $ hg diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
32 diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
33 --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
34 +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
35 @@ -2,7 +2,7 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
36 c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
37 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
38 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
39 -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
40 +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
41 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
42 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
43 c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
44
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
45 invalid --unified
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
46
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
47 $ hg diff --nodates -U foo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
48 abort: diff context lines count must be an integer, not 'foo'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12141
diff changeset
49 [255]
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
50
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
51
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
52 $ hg diff --nodates -U 2
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
53 diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
54 --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
55 +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
56 @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
57 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
58 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
59 -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
60 +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
61 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
62 a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
63
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
64 $ hg --config diff.unified=2 diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
65 diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
66 --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
67 +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
68 @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
69 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
70 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
71 -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
72 +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
73 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
74 a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
75
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
76 $ hg diff --nodates -U 1
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
77 diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
78 --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
79 +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
80 @@ -4,3 +4,3 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
81 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
82 -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
83 +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
84 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
85
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
86 invalid diff.unified
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
87
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
88 $ hg --config diff.unified=foo diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
89 abort: diff context lines count must be an integer, not 'foo'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12141
diff changeset
90 [255]
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
91
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
92 0 lines of context hunk header matches gnu diff hunk header
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
93
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
94 $ hg init diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
95 $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
96 $ cat > f1 << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
97 > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
98 > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
99 > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
100 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
101 $ hg commit -Am0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
102 adding f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
103
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
104 $ cat > f2 << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
105 > c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
106 > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
107 > c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
108 > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
109 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
110 $ diff -U0 f1 f2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
111 --- f1 * (glob)
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
112 +++ f2 * (glob)
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
113 @@ -0,0 +1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
114 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
115 @@ -1,0 +3 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
116 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
117 @@ -3 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
118 -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
119 [1]
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
120
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
121 $ mv f2 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
122 $ hg diff -U0 --nodates
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
123 diff -r 55d8ff78db23 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
124 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
125 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
126 @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
127 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
128 @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
129 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
130 @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
131 -c5
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
132
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
133 $ hg diff -U0 --nodates --git
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
134 diff --git a/f1 b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
135 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
136 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
137 @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
138 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
139 @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
140 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
141 @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
142 -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
143
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
144 $ hg diff -U0 --nodates -p
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
145 diff -r 55d8ff78db23 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
146 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
147 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
148 @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
149 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
150 @@ -1,0 +3,1 @@ c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
151 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
152 @@ -3,1 +4,0 @@ c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
153 -c5