annotate tests/test-diff-unified.t @ 32395:24245b54aa8a

match: replace match class by match function (API) The matcher class is getting hard to understand. It will be easier to follow if we can break it up into simpler matchers that we then compose. I'm hoping to have one matcher that accepts regular (non-include) patterns, one for exact file matches, one that always matches (and maybe one that never does) and then compose them by intersection and difference. This patch takes a simple but important step towards that goal by making match.match() a function (and renaming the matcher class itself from "match" to "matcher"). The new function will eventually be responsible for creating the simple matchers and composing them. icasefsmatcher similarly gets a factory function (called "icasefsmatch"). I also moved the other factory functions nearby.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 12 May 2017 23:11:41 -0700
parents 897726622877
children 44c4a38bf563
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
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
92 noprefix config and option
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
93
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
94 $ hg --config diff.noprefix=True diff --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
95 diff -r cf9f4ba66af2 a
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
96 --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
97 +++ a
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
98 @@ -2,7 +2,7 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
99 c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
100 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
101 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
102 -b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
103 +dd
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
104 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
105 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
106 c
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
107 $ hg diff --noprefix --nodates
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
108 diff -r cf9f4ba66af2 a
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
109 --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
110 +++ a
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
111 @@ -2,7 +2,7 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
112 c
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
113 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
114 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
115 -b
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
116 +dd
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
117 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
118 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
119 c
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
120
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
121 noprefix config disabled in plain mode, but option still enabled
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
122
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
123 $ HGPLAIN=1 hg --config diff.noprefix=True diff --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
124 diff -r cf9f4ba66af2 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
125 --- a/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
126 +++ b/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
127 @@ -2,7 +2,7 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
128 c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
129 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
130 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
131 -b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
132 +dd
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
133 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
134 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
135 c
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
136 $ HGPLAIN=1 hg diff --noprefix --nodates
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
137 diff -r cf9f4ba66af2 a
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
138 --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
139 +++ a
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
140 @@ -2,7 +2,7 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
141 c
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
142 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
143 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
144 -b
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
145 +dd
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
146 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
147 a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
148 c
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
149
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
150 $ cd ..
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
151
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
152
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
153 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
154
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
155 $ 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
156 $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
157 $ 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
158 > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
159 > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
160 > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
161 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
162 $ 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
163 adding f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
164
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
165 $ 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
166 > c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
167 > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
168 > c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
169 > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
170 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
171 $ 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
172 $ 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
173 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
174 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
175 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
176 @@ -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
177 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
178 @@ -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
179 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
180 @@ -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
181 -c5
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
182
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
183 $ 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
184 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
185 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
186 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
187 @@ -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
188 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
189 @@ -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
190 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
191 @@ -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
192 -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
193
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
194 $ 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
195 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
196 --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
197 +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
198 @@ -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
199 +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
200 @@ -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
201 +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
202 @@ -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
203 -c5
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
204
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
205 $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
206 $ hg ci -m movef2
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
207
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
208 Test diff headers terminating with TAB when necessary (issue3357)
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
209 Regular diff --nodates, file creation
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
210
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
211 $ hg mv f1 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
212 $ echo b > 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
213 $ hg diff --nodates 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
214 diff -r 7574207d0d15 f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
215 --- /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
216 +++ b/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
217 @@ -0,0 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
218 +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
219
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
220 Git diff, adding space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
221
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
222 $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
223 diff --git a/f1 b/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
224 rename from f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
225 rename to f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
226 --- a/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
227 +++ b/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
228 @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
229 -a
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
230 +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
231
30807
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
232 Git diff, adding extended headers
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
233
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
234 $ hg diff --git --config experimental.extendedheader.index=7 --config experimental.extendedheader.similarity=True
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
235 diff --git a/f1 b/f 1
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
236 similarity index 0%
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
237 rename from f1
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
238 rename to f 1
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
239 index 7898192..6178079 100644
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
240 --- a/f1
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
241 +++ b/f 1
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
242 @@ -1,1 +1,1 @@
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
243 -a
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
244 +b
6381a6dbc325 patch: use opt.showsimilarity to calculate and show the similarity
Sean Farley <sean@farley.io>
parents: 29948
diff changeset
245
30819
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
246 $ hg diff --git --config experimental.extendedheader.index=-1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
247 invalid length for extendedheader.index: '-1'
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
248 diff --git a/f1 b/f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
249 rename from f1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
250 rename to f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
251 --- a/f1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
252 +++ b/f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
253 @@ -1,1 +1,1 @@
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
254 -a
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
255 +b
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
256
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
257 $ hg diff --git --config experimental.extendedheader.index=whatever
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
258 invalid value for extendedheader.index: 'whatever'
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
259 diff --git a/f1 b/f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
260 rename from f1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
261 rename to f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
262 --- a/f1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
263 +++ b/f 1
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
264 @@ -1,1 +1,1 @@
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
265 -a
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
266 +b
897726622877 patch: check length of git index header only if integer is specified
Yuya Nishihara <yuya@tcha.org>
parents: 30807
diff changeset
267
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
268 Git diff with noprefix
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
269
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
270 $ hg --config diff.noprefix=True diff --git --nodates
23300
f8b5c3e77d4b patch.trydiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23299
diff changeset
271 diff --git f1 f 1
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
272 rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
273 rename to f 1
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
274 --- f1
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
275 +++ f 1
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
276 @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
277 -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
278 +b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
279
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
280 noprefix config disabled in plain mode, but option still enabled
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
281
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
282 $ HGPLAIN=1 hg --config diff.noprefix=True diff --git --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
283 diff --git a/f1 b/f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
284 rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
285 rename to f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
286 --- a/f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
287 +++ b/f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
288 @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
289 -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
290 +b
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
291 $ HGPLAIN=1 hg diff --git --noprefix --nodates
23300
f8b5c3e77d4b patch.trydiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23299
diff changeset
292 diff --git f1 f 1
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
293 rename from f1
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
294 rename to f 1
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
295 --- f1
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
296 +++ f 1
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
297 @@ -1,1 +1,1 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
298 -a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
299 +b
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
300
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
301 Regular diff --nodates, file deletion
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
302
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
303 $ hg ci -m addspace
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
304 $ hg mv 'f 1' f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
305 $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
306 $ hg diff --nodates 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
307 diff -r ca50fe67c9c7 f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
308 --- a/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
309 +++ /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
310 @@ -1,1 +0,0 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
311 -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
312
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
313 Git diff, removing space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
314
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
315 $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
316 diff --git a/f 1 b/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
317 rename from f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
318 rename to f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
319 --- a/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
320 +++ b/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
321 @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
322 -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
323 +a
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
324
24496
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
325 showfunc diff
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
326 $ cat > f1 << EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
327 > int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
328 > int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
329 > int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
330 > int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
331 > int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
332 > return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
333 > }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
334 > EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
335 $ hg commit -m addfunction
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
336 $ cat > f1 << EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
337 > int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
338 > int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
339 > int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
340 > int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
341 > int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
342 > return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
343 > }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
344 > EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
345 $ hg diff --git
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
346 diff --git a/f1 b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
347 --- a/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
348 +++ b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
349 @@ -2,6 +2,6 @@
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
350 int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
351 int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
352 int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
353 - int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
354 - return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
355 + int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
356 + return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
357 }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
358 $ hg diff --config diff.showfunc=True --git
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
359 diff --git a/f1 b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
360 --- a/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
361 +++ b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
362 @@ -2,6 +2,6 @@ int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
363 int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
364 int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
365 int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
366 - int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
367 - return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
368 + int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
369 + return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
370 }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
371
29948
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
372 If [diff] git is set to true, but the user says --no-git, we should
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
373 *not* get git diffs
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
374 $ hg diff --nodates --config diff.git=1 --no-git
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
375 diff -r f2c7c817fa55 f1
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
376 --- a/f1
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
377 +++ b/f1
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
378 @@ -2,6 +2,6 @@
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
379 int a = 0;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
380 int b = 1;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
381 int c = 2;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
382 - int d = 3;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
383 - return a + b + c + d;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
384 + int e = 3;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
385 + return a + b + c + e;
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
386 }
e40343ce9c4c diffopts: notice a negated boolean flag in diffopts
Augie Fackler <augie@google.com>
parents: 24496
diff changeset
387
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
388 $ cd ..