##// END OF EJS Templates
tests: add test to demonstrate issue4037...
Pulkit Goyal -
r41949:7b04b115 default
parent child Browse files
Show More
@@ -1,284 +1,291 b''
1 1 $ hg init repo
2 2 $ cd repo
3 3 $ i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=`expr $i + 1`; done
4 4 $ hg add a
5 5 $ cp a b
6 6 $ hg add b
7 7
8 8 Wide diffstat:
9 9
10 10 $ hg diff --stat
11 11 a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 12 b | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
13 13 2 files changed, 426 insertions(+), 0 deletions(-)
14 14
15 15 diffstat width:
16 16
17 17 $ COLUMNS=24 hg diff --config ui.interactive=true --stat
18 18 a | 213 ++++++++++++++
19 19 b | 213 ++++++++++++++
20 20 2 files changed, 426 insertions(+), 0 deletions(-)
21 21
22 22 $ hg ci -m adda
23 23
24 24 $ cat >> a <<EOF
25 25 > a
26 26 > a
27 27 > a
28 28 > EOF
29 29
30 30 Narrow diffstat:
31 31
32 32 $ hg diff --stat
33 33 a | 3 +++
34 34 1 files changed, 3 insertions(+), 0 deletions(-)
35 35
36 36 $ hg ci -m appenda
37 37
38 38 >>> open("c", "wb").write(b"\0") and None
39 39 $ touch d
40 40 $ hg add c d
41 41
42 42 Binary diffstat:
43 43
44 44 $ hg diff --stat
45 45 c | Bin
46 46 1 files changed, 0 insertions(+), 0 deletions(-)
47 47
48 48 Binary git diffstat:
49 49
50 50 $ hg diff --stat --git
51 51 c | Bin
52 52 d | 0
53 53 2 files changed, 0 insertions(+), 0 deletions(-)
54 54
55 55 $ hg ci -m createb
56 56
57 57 >>> open("file with spaces", "wb").write(b"\0") and None
58 58 $ hg add "file with spaces"
59 59
60 60 Filename with spaces diffstat:
61 61
62 62 $ hg diff --stat
63 63 file with spaces | Bin
64 64 1 files changed, 0 insertions(+), 0 deletions(-)
65 65
66 66 Filename with spaces git diffstat:
67 67
68 68 $ hg diff --stat --git
69 69 file with spaces | Bin
70 70 1 files changed, 0 insertions(+), 0 deletions(-)
71 71
72 72 Filename without "a/" or "b/" (issue5759):
73 73
74 74 $ hg diff --config 'diff.noprefix=1' -c1 --stat --git
75 75 a | 3 +++
76 76 1 files changed, 3 insertions(+), 0 deletions(-)
77 77 $ hg diff --config 'diff.noprefix=1' -c2 --stat --git
78 78 c | Bin
79 79 d | 0
80 80 2 files changed, 0 insertions(+), 0 deletions(-)
81 81
82 82 $ hg log --config 'diff.noprefix=1' -r '1:' -p --stat --git
83 83 changeset: 1:3a95b07bb77f
84 84 user: test
85 85 date: Thu Jan 01 00:00:00 1970 +0000
86 86 summary: appenda
87 87
88 88 a | 3 +++
89 89 1 files changed, 3 insertions(+), 0 deletions(-)
90 90
91 91 diff --git a a
92 92 --- a
93 93 +++ a
94 94 @@ -211,3 +211,6 @@
95 95 a
96 96 a
97 97 a
98 98 +a
99 99 +a
100 100 +a
101 101
102 102 changeset: 2:c60a6c753773
103 103 tag: tip
104 104 user: test
105 105 date: Thu Jan 01 00:00:00 1970 +0000
106 106 summary: createb
107 107
108 108 c | Bin
109 109 d | 0
110 110 2 files changed, 0 insertions(+), 0 deletions(-)
111 111
112 112 diff --git c c
113 113 new file mode 100644
114 114 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d
115 115 GIT binary patch
116 116 literal 1
117 117 Ic${MZ000310RR91
118 118
119 119 diff --git d d
120 120 new file mode 100644
121 121
122 122
123 123 diffstat within directories:
124 124
125 125 $ hg rm -f 'file with spaces'
126 126
127 127 $ mkdir dir1 dir2
128 128 $ echo new1 > dir1/new
129 129 $ echo new2 > dir2/new
130 130 $ hg add dir1/new dir2/new
131 131 $ hg diff --stat
132 132 dir1/new | 1 +
133 133 dir2/new | 1 +
134 134 2 files changed, 2 insertions(+), 0 deletions(-)
135 135
136 136 $ hg diff --stat --root dir1
137 137 new | 1 +
138 138 1 files changed, 1 insertions(+), 0 deletions(-)
139 139
140 140 $ hg diff --stat --root dir1 dir2
141 141 warning: dir2 not inside relative root dir1
142 142
143 143 $ hg diff --stat --root dir1 -I dir1/old
144 144
145 145 $ cd dir1
146 146 $ hg diff --stat .
147 147 dir1/new | 1 +
148 148 1 files changed, 1 insertions(+), 0 deletions(-)
149 149 $ hg diff --stat . --config ui.relative-paths=yes
150 150 new | 1 +
151 151 1 files changed, 1 insertions(+), 0 deletions(-)
152 152 $ hg diff --stat --root .
153 153 new | 1 +
154 154 1 files changed, 1 insertions(+), 0 deletions(-)
155 155
156 156 $ hg diff --stat --root . --config ui.relative-paths=yes
157 157 new | 1 +
158 158 1 files changed, 1 insertions(+), 0 deletions(-)
159 159 --root trumps ui.relative-paths
160 160 $ hg diff --stat --root .. --config ui.relative-paths=yes
161 161 new | 1 +
162 162 ../dir2/new | 1 +
163 163 2 files changed, 2 insertions(+), 0 deletions(-)
164 164 $ hg diff --stat --root ../dir1 ../dir2
165 165 warning: ../dir2 not inside relative root .
166 166
167 167 $ hg diff --stat --root . -I old
168 168
169 169 $ cd ..
170 170
171 171 Files with lines beginning with '--' or '++' should be properly counted in diffstat
172 172
173 173 $ hg up -Cr tip
174 174 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 175 $ rm dir1/new
176 176 $ rm dir2/new
177 177 $ rm "file with spaces"
178 178 $ cat > file << EOF
179 179 > line 1
180 180 > line 2
181 181 > line 3
182 182 > EOF
183 183 $ hg commit -Am file
184 184 adding file
185 185
186 186 Lines added starting with '--' should count as additions
187 187 $ cat > file << EOF
188 188 > line 1
189 189 > -- line 2, with dashes
190 190 > line 3
191 191 > EOF
192 192
193 193 $ hg diff --root .
194 194 diff -r be1569354b24 file
195 195 --- a/file Thu Jan 01 00:00:00 1970 +0000
196 196 +++ b/file * (glob)
197 197 @@ -1,3 +1,3 @@
198 198 line 1
199 199 -line 2
200 200 +-- line 2, with dashes
201 201 line 3
202 202
203 203 $ hg diff --root . --stat
204 204 file | 2 +-
205 205 1 files changed, 1 insertions(+), 1 deletions(-)
206 206
207 207 Lines changed starting with '--' should count as deletions
208 208 $ hg commit -m filev2
209 209 $ cat > file << EOF
210 210 > line 1
211 211 > -- line 2, with dashes, changed again
212 212 > line 3
213 213 > EOF
214 214
215 215 $ hg diff --root .
216 216 diff -r 160f7c034df6 file
217 217 --- a/file Thu Jan 01 00:00:00 1970 +0000
218 218 +++ b/file * (glob)
219 219 @@ -1,3 +1,3 @@
220 220 line 1
221 221 --- line 2, with dashes
222 222 +-- line 2, with dashes, changed again
223 223 line 3
224 224
225 225 $ hg diff --root . --stat
226 226 file | 2 +-
227 227 1 files changed, 1 insertions(+), 1 deletions(-)
228 228
229 229 Lines changed starting with '--' should count as deletions
230 230 and starting with '++' should count as additions
231 231 $ cat > file << EOF
232 232 > line 1
233 233 > ++ line 2, switched dashes to plusses
234 234 > line 3
235 235 > EOF
236 236
237 237 $ hg diff --root .
238 238 diff -r 160f7c034df6 file
239 239 --- a/file Thu Jan 01 00:00:00 1970 +0000
240 240 +++ b/file * (glob)
241 241 @@ -1,3 +1,3 @@
242 242 line 1
243 243 --- line 2, with dashes
244 244 +++ line 2, switched dashes to plusses
245 245 line 3
246 246
247 247 $ hg diff --root . --stat
248 248 file | 2 +-
249 249 1 files changed, 1 insertions(+), 1 deletions(-)
250 250
251 251 When a file is renamed, --git shouldn't loss the info about old file
252 252 $ hg init issue6025
253 253 $ cd issue6025
254 254 $ echo > a
255 255 $ hg ci -Am 'add a'
256 256 adding a
257 257 $ hg mv a b
258 258 $ hg diff --git
259 259 diff --git a/a b/b
260 260 rename from a
261 261 rename to b
262 262 $ hg diff --stat
263 263 a | 1 -
264 264 b | 1 +
265 265 2 files changed, 1 insertions(+), 1 deletions(-)
266 266 $ hg diff --stat --git
267 267 a => b | 0
268 268 1 files changed, 0 insertions(+), 0 deletions(-)
269 269 -- filename may contain whitespaces
270 270 $ echo > c
271 271 $ hg ci -Am 'add c'
272 272 adding c
273 273 $ hg mv c 'new c'
274 274 $ hg diff --git
275 275 diff --git a/c b/new c
276 276 rename from c
277 277 rename to new c
278 278 $ hg diff --stat
279 279 c | 1 -
280 280 new c | 1 +
281 281 2 files changed, 1 insertions(+), 1 deletions(-)
282 282 $ hg diff --stat --git
283 283 c => new c | 0
284 284 1 files changed, 0 insertions(+), 0 deletions(-)
285
286 Make sure `diff --stat -q --config diff.git-0` shows stat (issue4037)
287
288 $ hg status
289 A new c
290 R c
291 $ hg diff --stat -q
General Comments 0
You need to be logged in to leave comments. Login now