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