##// END OF EJS Templates
tests: test "hg log" with --line-range and --copies...
Denis Laxalde -
r44030:d3c43680 default
parent child Browse files
Show More
@@ -1,922 +1,1028 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [diff]
2 > [diff]
3 > git = true
3 > git = true
4 > EOF
4 > EOF
5
5
6 $ hg init
6 $ hg init
7 $ cat > foo << EOF
7 $ cat > foo << EOF
8 > 0
8 > 0
9 > 1
9 > 1
10 > 2
10 > 2
11 > 3
11 > 3
12 > 4
12 > 4
13 > EOF
13 > EOF
14 $ hg ci -Am init
14 $ hg ci -Am init
15 adding foo
15 adding foo
16 $ cat > foo << EOF
16 $ cat > foo << EOF
17 > 0
17 > 0
18 > 0
18 > 0
19 > 0
19 > 0
20 > 0
20 > 0
21 > 1
21 > 1
22 > 2
22 > 2
23 > 3
23 > 3
24 > 4
24 > 4
25 > EOF
25 > EOF
26 $ hg ci -m 'more 0'
26 $ hg ci -m 'more 0'
27 $ sed 's/2/2+/' foo > foo.new
27 $ sed 's/2/2+/' foo > foo.new
28 $ mv foo.new foo
28 $ mv foo.new foo
29 $ cat > bar << EOF
29 $ cat > bar << EOF
30 > a
30 > a
31 > b
31 > b
32 > c
32 > c
33 > d
33 > d
34 > e
34 > e
35 > EOF
35 > EOF
36 $ hg add bar
36 $ hg add bar
37 $ hg ci -Am "2 -> 2+; added bar"
37 $ hg ci -Am "2 -> 2+; added bar"
38 $ cat >> foo << EOF
38 $ cat >> foo << EOF
39 > 5
39 > 5
40 > 6
40 > 6
41 > 7
41 > 7
42 > 8
42 > 8
43 > 9
43 > 9
44 > 10
44 > 10
45 > 11
45 > 11
46 > EOF
46 > EOF
47 $ hg ci -m "to 11"
47 $ hg ci -m "to 11"
48
48
49 Add some changes with two diff hunks
49 Add some changes with two diff hunks
50
50
51 $ sed 's/^1$/ 1/' foo > foo.new
51 $ sed 's/^1$/ 1/' foo > foo.new
52 $ mv foo.new foo
52 $ mv foo.new foo
53 $ sed 's/^11$/11+/' foo > foo.new
53 $ sed 's/^11$/11+/' foo > foo.new
54 $ mv foo.new foo
54 $ mv foo.new foo
55 $ hg ci -m '11 -> 11+; leading space before "1"'
55 $ hg ci -m '11 -> 11+; leading space before "1"'
56 (make sure there are two hunks in "foo")
56 (make sure there are two hunks in "foo")
57 $ hg diff -c .
57 $ hg diff -c .
58 diff --git a/foo b/foo
58 diff --git a/foo b/foo
59 --- a/foo
59 --- a/foo
60 +++ b/foo
60 +++ b/foo
61 @@ -2,7 +2,7 @@
61 @@ -2,7 +2,7 @@
62 0
62 0
63 0
63 0
64 0
64 0
65 -1
65 -1
66 + 1
66 + 1
67 2+
67 2+
68 3
68 3
69 4
69 4
70 @@ -12,4 +12,4 @@
70 @@ -12,4 +12,4 @@
71 8
71 8
72 9
72 9
73 10
73 10
74 -11
74 -11
75 +11+
75 +11+
76 $ sed 's/3/3+/' foo > foo.new
76 $ sed 's/3/3+/' foo > foo.new
77 $ mv foo.new foo
77 $ mv foo.new foo
78 $ sed 's/^11+$/11-/' foo > foo.new
78 $ sed 's/^11+$/11-/' foo > foo.new
79 $ mv foo.new foo
79 $ mv foo.new foo
80 $ sed 's/a/a+/' bar > bar.new
80 $ sed 's/a/a+/' bar > bar.new
81 $ mv bar.new bar
81 $ mv bar.new bar
82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 (make sure there are two hunks in "foo")
83 (make sure there are two hunks in "foo")
84 $ hg diff -c . foo
84 $ hg diff -c . foo
85 diff --git a/foo b/foo
85 diff --git a/foo b/foo
86 --- a/foo
86 --- a/foo
87 +++ b/foo
87 +++ b/foo
88 @@ -4,7 +4,7 @@
88 @@ -4,7 +4,7 @@
89 0
89 0
90 1
90 1
91 2+
91 2+
92 -3
92 -3
93 +3+
93 +3+
94 4
94 4
95 5
95 5
96 6
96 6
97 @@ -12,4 +12,4 @@
97 @@ -12,4 +12,4 @@
98 8
98 8
99 9
99 9
100 10
100 10
101 -11+
101 -11+
102 +11-
102 +11-
103
103
104 $ hg log -f -L foo,5:7 -p
104 $ hg log -f -L foo,5:7 -p
105 changeset: 5:cfdf972b3971
105 changeset: 5:cfdf972b3971
106 tag: tip
106 tag: tip
107 user: test
107 user: test
108 date: Thu Jan 01 00:00:00 1970 +0000
108 date: Thu Jan 01 00:00:00 1970 +0000
109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110
110
111 diff --git a/foo b/foo
111 diff --git a/foo b/foo
112 --- a/foo
112 --- a/foo
113 +++ b/foo
113 +++ b/foo
114 @@ -4,7 +4,7 @@
114 @@ -4,7 +4,7 @@
115 0
115 0
116 1
116 1
117 2+
117 2+
118 -3
118 -3
119 +3+
119 +3+
120 4
120 4
121 5
121 5
122 6
122 6
123
123
124 changeset: 4:eaec41c1a0c9
124 changeset: 4:eaec41c1a0c9
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:00 1970 +0000
126 date: Thu Jan 01 00:00:00 1970 +0000
127 summary: 11 -> 11+; leading space before "1"
127 summary: 11 -> 11+; leading space before "1"
128
128
129 diff --git a/foo b/foo
129 diff --git a/foo b/foo
130 --- a/foo
130 --- a/foo
131 +++ b/foo
131 +++ b/foo
132 @@ -2,7 +2,7 @@
132 @@ -2,7 +2,7 @@
133 0
133 0
134 0
134 0
135 0
135 0
136 -1
136 -1
137 + 1
137 + 1
138 2+
138 2+
139 3
139 3
140 4
140 4
141
141
142 changeset: 2:63a884426fd0
142 changeset: 2:63a884426fd0
143 user: test
143 user: test
144 date: Thu Jan 01 00:00:00 1970 +0000
144 date: Thu Jan 01 00:00:00 1970 +0000
145 summary: 2 -> 2+; added bar
145 summary: 2 -> 2+; added bar
146
146
147 diff --git a/foo b/foo
147 diff --git a/foo b/foo
148 --- a/foo
148 --- a/foo
149 +++ b/foo
149 +++ b/foo
150 @@ -3,6 +3,6 @@
150 @@ -3,6 +3,6 @@
151 0
151 0
152 0
152 0
153 1
153 1
154 -2
154 -2
155 +2+
155 +2+
156 3
156 3
157 4
157 4
158
158
159 changeset: 0:5ae1f82b9a00
159 changeset: 0:5ae1f82b9a00
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: init
162 summary: init
163
163
164 diff --git a/foo b/foo
164 diff --git a/foo b/foo
165 new file mode 100644
165 new file mode 100644
166 --- /dev/null
166 --- /dev/null
167 +++ b/foo
167 +++ b/foo
168 @@ -0,0 +1,5 @@
168 @@ -0,0 +1,5 @@
169 +0
169 +0
170 +1
170 +1
171 +2
171 +2
172 +3
172 +3
173 +4
173 +4
174
174
175 $ hg log -f --graph -L foo,5:7 -p
175 $ hg log -f --graph -L foo,5:7 -p
176 @ changeset: 5:cfdf972b3971
176 @ changeset: 5:cfdf972b3971
177 | tag: tip
177 | tag: tip
178 | user: test
178 | user: test
179 | date: Thu Jan 01 00:00:00 1970 +0000
179 | date: Thu Jan 01 00:00:00 1970 +0000
180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 |
181 |
182 | diff --git a/foo b/foo
182 | diff --git a/foo b/foo
183 | --- a/foo
183 | --- a/foo
184 | +++ b/foo
184 | +++ b/foo
185 | @@ -4,7 +4,7 @@
185 | @@ -4,7 +4,7 @@
186 | 0
186 | 0
187 | 1
187 | 1
188 | 2+
188 | 2+
189 | -3
189 | -3
190 | +3+
190 | +3+
191 | 4
191 | 4
192 | 5
192 | 5
193 | 6
193 | 6
194 |
194 |
195 o changeset: 4:eaec41c1a0c9
195 o changeset: 4:eaec41c1a0c9
196 : user: test
196 : user: test
197 : date: Thu Jan 01 00:00:00 1970 +0000
197 : date: Thu Jan 01 00:00:00 1970 +0000
198 : summary: 11 -> 11+; leading space before "1"
198 : summary: 11 -> 11+; leading space before "1"
199 :
199 :
200 : diff --git a/foo b/foo
200 : diff --git a/foo b/foo
201 : --- a/foo
201 : --- a/foo
202 : +++ b/foo
202 : +++ b/foo
203 : @@ -2,7 +2,7 @@
203 : @@ -2,7 +2,7 @@
204 : 0
204 : 0
205 : 0
205 : 0
206 : 0
206 : 0
207 : -1
207 : -1
208 : + 1
208 : + 1
209 : 2+
209 : 2+
210 : 3
210 : 3
211 : 4
211 : 4
212 :
212 :
213 o changeset: 2:63a884426fd0
213 o changeset: 2:63a884426fd0
214 : user: test
214 : user: test
215 : date: Thu Jan 01 00:00:00 1970 +0000
215 : date: Thu Jan 01 00:00:00 1970 +0000
216 : summary: 2 -> 2+; added bar
216 : summary: 2 -> 2+; added bar
217 :
217 :
218 : diff --git a/foo b/foo
218 : diff --git a/foo b/foo
219 : --- a/foo
219 : --- a/foo
220 : +++ b/foo
220 : +++ b/foo
221 : @@ -3,6 +3,6 @@
221 : @@ -3,6 +3,6 @@
222 : 0
222 : 0
223 : 0
223 : 0
224 : 1
224 : 1
225 : -2
225 : -2
226 : +2+
226 : +2+
227 : 3
227 : 3
228 : 4
228 : 4
229 :
229 :
230 o changeset: 0:5ae1f82b9a00
230 o changeset: 0:5ae1f82b9a00
231 user: test
231 user: test
232 date: Thu Jan 01 00:00:00 1970 +0000
232 date: Thu Jan 01 00:00:00 1970 +0000
233 summary: init
233 summary: init
234
234
235 diff --git a/foo b/foo
235 diff --git a/foo b/foo
236 new file mode 100644
236 new file mode 100644
237 --- /dev/null
237 --- /dev/null
238 +++ b/foo
238 +++ b/foo
239 @@ -0,0 +1,5 @@
239 @@ -0,0 +1,5 @@
240 +0
240 +0
241 +1
241 +1
242 +2
242 +2
243 +3
243 +3
244 +4
244 +4
245
245
246
246
247 With --template.
247 With --template.
248
248
249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 2:63a884426fd0 2 -> 2+; added bar
252 2:63a884426fd0 2 -> 2+; added bar
253 0:5ae1f82b9a00 init
253 0:5ae1f82b9a00 init
254 $ hg log -f -L foo,5:7 -T json
254 $ hg log -f -L foo,5:7 -T json
255 [
255 [
256 {
256 {
257 "bookmarks": [],
257 "bookmarks": [],
258 "branch": "default",
258 "branch": "default",
259 "date": [0, 0],
259 "date": [0, 0],
260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 "phase": "draft",
263 "phase": "draft",
264 "rev": 5,
264 "rev": 5,
265 "tags": ["tip"],
265 "tags": ["tip"],
266 "user": "test"
266 "user": "test"
267 },
267 },
268 {
268 {
269 "bookmarks": [],
269 "bookmarks": [],
270 "branch": "default",
270 "branch": "default",
271 "date": [0, 0],
271 "date": [0, 0],
272 "desc": "11 -> 11+; leading space before \"1\"",
272 "desc": "11 -> 11+; leading space before \"1\"",
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 "phase": "draft",
275 "phase": "draft",
276 "rev": 4,
276 "rev": 4,
277 "tags": [],
277 "tags": [],
278 "user": "test"
278 "user": "test"
279 },
279 },
280 {
280 {
281 "bookmarks": [],
281 "bookmarks": [],
282 "branch": "default",
282 "branch": "default",
283 "date": [0, 0],
283 "date": [0, 0],
284 "desc": "2 -> 2+; added bar",
284 "desc": "2 -> 2+; added bar",
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 "phase": "draft",
287 "phase": "draft",
288 "rev": 2,
288 "rev": 2,
289 "tags": [],
289 "tags": [],
290 "user": "test"
290 "user": "test"
291 },
291 },
292 {
292 {
293 "bookmarks": [],
293 "bookmarks": [],
294 "branch": "default",
294 "branch": "default",
295 "date": [0, 0],
295 "date": [0, 0],
296 "desc": "init",
296 "desc": "init",
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 "parents": ["0000000000000000000000000000000000000000"],
298 "parents": ["0000000000000000000000000000000000000000"],
299 "phase": "draft",
299 "phase": "draft",
300 "rev": 0,
300 "rev": 0,
301 "tags": [],
301 "tags": [],
302 "user": "test"
302 "user": "test"
303 }
303 }
304 ]
304 ]
305
305
306 With some white-space diff option, respective revisions are skipped.
306 With some white-space diff option, respective revisions are skipped.
307
307
308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 changeset: 5:cfdf972b3971
309 changeset: 5:cfdf972b3971
310 tag: tip
310 tag: tip
311 user: test
311 user: test
312 date: Thu Jan 01 00:00:00 1970 +0000
312 date: Thu Jan 01 00:00:00 1970 +0000
313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314
314
315 diff --git a/foo b/foo
315 diff --git a/foo b/foo
316 --- a/foo
316 --- a/foo
317 +++ b/foo
317 +++ b/foo
318 @@ -4,7 +4,7 @@
318 @@ -4,7 +4,7 @@
319 0
319 0
320 1
320 1
321 2+
321 2+
322 -3
322 -3
323 +3+
323 +3+
324 4
324 4
325 5
325 5
326 6
326 6
327
327
328 changeset: 2:63a884426fd0
328 changeset: 2:63a884426fd0
329 user: test
329 user: test
330 date: Thu Jan 01 00:00:00 1970 +0000
330 date: Thu Jan 01 00:00:00 1970 +0000
331 summary: 2 -> 2+; added bar
331 summary: 2 -> 2+; added bar
332
332
333 diff --git a/foo b/foo
333 diff --git a/foo b/foo
334 --- a/foo
334 --- a/foo
335 +++ b/foo
335 +++ b/foo
336 @@ -3,6 +3,6 @@
336 @@ -3,6 +3,6 @@
337 0
337 0
338 0
338 0
339 1
339 1
340 -2
340 -2
341 +2+
341 +2+
342 3
342 3
343 4
343 4
344
344
345 changeset: 0:5ae1f82b9a00
345 changeset: 0:5ae1f82b9a00
346 user: test
346 user: test
347 date: Thu Jan 01 00:00:00 1970 +0000
347 date: Thu Jan 01 00:00:00 1970 +0000
348 summary: init
348 summary: init
349
349
350 diff --git a/foo b/foo
350 diff --git a/foo b/foo
351 new file mode 100644
351 new file mode 100644
352 --- /dev/null
352 --- /dev/null
353 +++ b/foo
353 +++ b/foo
354 @@ -0,0 +1,5 @@
354 @@ -0,0 +1,5 @@
355 +0
355 +0
356 +1
356 +1
357 +2
357 +2
358 +3
358 +3
359 +4
359 +4
360
360
361
361
362 Regular file patterns are not allowed.
362 Regular file patterns are not allowed.
363
363
364 $ hg log -f -L foo,5:7 -p bar
364 $ hg log -f -L foo,5:7 -p bar
365 abort: FILE arguments are not compatible with --line-range option
365 abort: FILE arguments are not compatible with --line-range option
366 [255]
366 [255]
367
367
368 Option --rev acts as a restriction.
368 Option --rev acts as a restriction.
369
369
370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 changeset: 2:63a884426fd0
371 changeset: 2:63a884426fd0
372 user: test
372 user: test
373 date: Thu Jan 01 00:00:00 1970 +0000
373 date: Thu Jan 01 00:00:00 1970 +0000
374 summary: 2 -> 2+; added bar
374 summary: 2 -> 2+; added bar
375
375
376 diff --git a/foo b/foo
376 diff --git a/foo b/foo
377 --- a/foo
377 --- a/foo
378 +++ b/foo
378 +++ b/foo
379 @@ -3,6 +3,6 @@
379 @@ -3,6 +3,6 @@
380 0
380 0
381 0
381 0
382 1
382 1
383 -2
383 -2
384 +2+
384 +2+
385 3
385 3
386 4
386 4
387
387
388 changeset: 0:5ae1f82b9a00
388 changeset: 0:5ae1f82b9a00
389 user: test
389 user: test
390 date: Thu Jan 01 00:00:00 1970 +0000
390 date: Thu Jan 01 00:00:00 1970 +0000
391 summary: init
391 summary: init
392
392
393 diff --git a/foo b/foo
393 diff --git a/foo b/foo
394 new file mode 100644
394 new file mode 100644
395 --- /dev/null
395 --- /dev/null
396 +++ b/foo
396 +++ b/foo
397 @@ -0,0 +1,5 @@
397 @@ -0,0 +1,5 @@
398 +0
398 +0
399 +1
399 +1
400 +2
400 +2
401 +3
401 +3
402 +4
402 +4
403
403
404
404
405 With several -L patterns, changes touching any files in their respective line
405 With several -L patterns, changes touching any files in their respective line
406 range are show.
406 range are show.
407
407
408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 changeset: 5:cfdf972b3971
409 changeset: 5:cfdf972b3971
410 tag: tip
410 tag: tip
411 user: test
411 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
412 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414
414
415 diff --git a/bar b/bar
415 diff --git a/bar b/bar
416 --- a/bar
416 --- a/bar
417 +++ b/bar
417 +++ b/bar
418 @@ -1,4 +1,4 @@
418 @@ -1,4 +1,4 @@
419 -a
419 -a
420 +a+
420 +a+
421 b
421 b
422 c
422 c
423 d
423 d
424 diff --git a/foo b/foo
424 diff --git a/foo b/foo
425 --- a/foo
425 --- a/foo
426 +++ b/foo
426 +++ b/foo
427 @@ -4,7 +4,7 @@
427 @@ -4,7 +4,7 @@
428 0
428 0
429 1
429 1
430 2+
430 2+
431 -3
431 -3
432 +3+
432 +3+
433 4
433 4
434 5
434 5
435 6
435 6
436
436
437 changeset: 4:eaec41c1a0c9
437 changeset: 4:eaec41c1a0c9
438 user: test
438 user: test
439 date: Thu Jan 01 00:00:00 1970 +0000
439 date: Thu Jan 01 00:00:00 1970 +0000
440 summary: 11 -> 11+; leading space before "1"
440 summary: 11 -> 11+; leading space before "1"
441
441
442 diff --git a/foo b/foo
442 diff --git a/foo b/foo
443 --- a/foo
443 --- a/foo
444 +++ b/foo
444 +++ b/foo
445 @@ -2,7 +2,7 @@
445 @@ -2,7 +2,7 @@
446 0
446 0
447 0
447 0
448 0
448 0
449 -1
449 -1
450 + 1
450 + 1
451 2+
451 2+
452 3
452 3
453 4
453 4
454
454
455 changeset: 2:63a884426fd0
455 changeset: 2:63a884426fd0
456 user: test
456 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
457 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: 2 -> 2+; added bar
458 summary: 2 -> 2+; added bar
459
459
460 diff --git a/bar b/bar
460 diff --git a/bar b/bar
461 new file mode 100644
461 new file mode 100644
462 --- /dev/null
462 --- /dev/null
463 +++ b/bar
463 +++ b/bar
464 @@ -0,0 +1,5 @@
464 @@ -0,0 +1,5 @@
465 +a
465 +a
466 +b
466 +b
467 +c
467 +c
468 +d
468 +d
469 +e
469 +e
470 diff --git a/foo b/foo
470 diff --git a/foo b/foo
471 --- a/foo
471 --- a/foo
472 +++ b/foo
472 +++ b/foo
473 @@ -3,6 +3,6 @@
473 @@ -3,6 +3,6 @@
474 0
474 0
475 0
475 0
476 1
476 1
477 -2
477 -2
478 +2+
478 +2+
479 3
479 3
480 4
480 4
481
481
482 changeset: 0:5ae1f82b9a00
482 changeset: 0:5ae1f82b9a00
483 user: test
483 user: test
484 date: Thu Jan 01 00:00:00 1970 +0000
484 date: Thu Jan 01 00:00:00 1970 +0000
485 summary: init
485 summary: init
486
486
487 diff --git a/foo b/foo
487 diff --git a/foo b/foo
488 new file mode 100644
488 new file mode 100644
489 --- /dev/null
489 --- /dev/null
490 +++ b/foo
490 +++ b/foo
491 @@ -0,0 +1,5 @@
491 @@ -0,0 +1,5 @@
492 +0
492 +0
493 +1
493 +1
494 +2
494 +2
495 +3
495 +3
496 +4
496 +4
497
497
498
498
499 Multiple -L options with the same file yields changes touching any of
499 Multiple -L options with the same file yields changes touching any of
500 specified line ranges.
500 specified line ranges.
501
501
502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 changeset: 5:cfdf972b3971
503 changeset: 5:cfdf972b3971
504 tag: tip
504 tag: tip
505 user: test
505 user: test
506 date: Thu Jan 01 00:00:00 1970 +0000
506 date: Thu Jan 01 00:00:00 1970 +0000
507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508
508
509 diff --git a/foo b/foo
509 diff --git a/foo b/foo
510 --- a/foo
510 --- a/foo
511 +++ b/foo
511 +++ b/foo
512 @@ -4,7 +4,7 @@
512 @@ -4,7 +4,7 @@
513 0
513 0
514 1
514 1
515 2+
515 2+
516 -3
516 -3
517 +3+
517 +3+
518 4
518 4
519 5
519 5
520 6
520 6
521 @@ -12,4 +12,4 @@
521 @@ -12,4 +12,4 @@
522 8
522 8
523 9
523 9
524 10
524 10
525 -11+
525 -11+
526 +11-
526 +11-
527
527
528 changeset: 4:eaec41c1a0c9
528 changeset: 4:eaec41c1a0c9
529 user: test
529 user: test
530 date: Thu Jan 01 00:00:00 1970 +0000
530 date: Thu Jan 01 00:00:00 1970 +0000
531 summary: 11 -> 11+; leading space before "1"
531 summary: 11 -> 11+; leading space before "1"
532
532
533 diff --git a/foo b/foo
533 diff --git a/foo b/foo
534 --- a/foo
534 --- a/foo
535 +++ b/foo
535 +++ b/foo
536 @@ -2,7 +2,7 @@
536 @@ -2,7 +2,7 @@
537 0
537 0
538 0
538 0
539 0
539 0
540 -1
540 -1
541 + 1
541 + 1
542 2+
542 2+
543 3
543 3
544 4
544 4
545 @@ -12,4 +12,4 @@
545 @@ -12,4 +12,4 @@
546 8
546 8
547 9
547 9
548 10
548 10
549 -11
549 -11
550 +11+
550 +11+
551
551
552 changeset: 3:730a61fbaecf
552 changeset: 3:730a61fbaecf
553 user: test
553 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: to 11
555 summary: to 11
556
556
557 diff --git a/foo b/foo
557 diff --git a/foo b/foo
558 --- a/foo
558 --- a/foo
559 +++ b/foo
559 +++ b/foo
560 @@ -6,3 +6,10 @@
560 @@ -6,3 +6,10 @@
561 2+
561 2+
562 3
562 3
563 4
563 4
564 +5
564 +5
565 +6
565 +6
566 +7
566 +7
567 +8
567 +8
568 +9
568 +9
569 +10
569 +10
570 +11
570 +11
571
571
572 changeset: 2:63a884426fd0
572 changeset: 2:63a884426fd0
573 user: test
573 user: test
574 date: Thu Jan 01 00:00:00 1970 +0000
574 date: Thu Jan 01 00:00:00 1970 +0000
575 summary: 2 -> 2+; added bar
575 summary: 2 -> 2+; added bar
576
576
577 diff --git a/foo b/foo
577 diff --git a/foo b/foo
578 --- a/foo
578 --- a/foo
579 +++ b/foo
579 +++ b/foo
580 @@ -3,6 +3,6 @@
580 @@ -3,6 +3,6 @@
581 0
581 0
582 0
582 0
583 1
583 1
584 -2
584 -2
585 +2+
585 +2+
586 3
586 3
587 4
587 4
588
588
589 changeset: 0:5ae1f82b9a00
589 changeset: 0:5ae1f82b9a00
590 user: test
590 user: test
591 date: Thu Jan 01 00:00:00 1970 +0000
591 date: Thu Jan 01 00:00:00 1970 +0000
592 summary: init
592 summary: init
593
593
594 diff --git a/foo b/foo
594 diff --git a/foo b/foo
595 new file mode 100644
595 new file mode 100644
596 --- /dev/null
596 --- /dev/null
597 +++ b/foo
597 +++ b/foo
598 @@ -0,0 +1,5 @@
598 @@ -0,0 +1,5 @@
599 +0
599 +0
600 +1
600 +1
601 +2
601 +2
602 +3
602 +3
603 +4
603 +4
604
604
605
605
606 A file with a comma in its name.
606 A file with a comma in its name.
607
607
608 $ cat > ba,z << EOF
608 $ cat > ba,z << EOF
609 > q
609 > q
610 > w
610 > w
611 > e
611 > e
612 > r
612 > r
613 > t
613 > t
614 > y
614 > y
615 > EOF
615 > EOF
616 $ hg ci -Am 'querty'
616 $ hg ci -Am 'querty'
617 adding ba,z
617 adding ba,z
618 $ cat >> ba,z << EOF
618 $ cat >> ba,z << EOF
619 > u
619 > u
620 > i
620 > i
621 > o
621 > o
622 > p
622 > p
623 > EOF
623 > EOF
624 $ hg ci -m 'more keys'
624 $ hg ci -m 'more keys'
625 $ cat > ba,z << EOF
625 $ cat > ba,z << EOF
626 > a
626 > a
627 > z
627 > z
628 > e
628 > e
629 > r
629 > r
630 > t
630 > t
631 > y
631 > y
632 > u
632 > u
633 > i
633 > i
634 > o
634 > o
635 > p
635 > p
636 > EOF
636 > EOF
637 $ hg ci -m 'azerty'
637 $ hg ci -m 'azerty'
638 $ hg log -f -L ba,z,1:2 -p
638 $ hg log -f -L ba,z,1:2 -p
639 changeset: 8:52373265138b
639 changeset: 8:52373265138b
640 tag: tip
640 tag: tip
641 user: test
641 user: test
642 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
643 summary: azerty
643 summary: azerty
644
644
645 diff --git a/ba,z b/ba,z
645 diff --git a/ba,z b/ba,z
646 --- a/ba,z
646 --- a/ba,z
647 +++ b/ba,z
647 +++ b/ba,z
648 @@ -1,5 +1,5 @@
648 @@ -1,5 +1,5 @@
649 -q
649 -q
650 -w
650 -w
651 +a
651 +a
652 +z
652 +z
653 e
653 e
654 r
654 r
655 t
655 t
656
656
657 changeset: 6:96ba8850f316
657 changeset: 6:96ba8850f316
658 user: test
658 user: test
659 date: Thu Jan 01 00:00:00 1970 +0000
659 date: Thu Jan 01 00:00:00 1970 +0000
660 summary: querty
660 summary: querty
661
661
662 diff --git a/ba,z b/ba,z
662 diff --git a/ba,z b/ba,z
663 new file mode 100644
663 new file mode 100644
664 --- /dev/null
664 --- /dev/null
665 +++ b/ba,z
665 +++ b/ba,z
666 @@ -0,0 +1,6 @@
666 @@ -0,0 +1,6 @@
667 +q
667 +q
668 +w
668 +w
669 +e
669 +e
670 +r
670 +r
671 +t
671 +t
672 +y
672 +y
673
673
674
674
675 Exact prefix kinds work in -L options.
675 Exact prefix kinds work in -L options.
676
676
677 $ mkdir dir
677 $ mkdir dir
678 $ cd dir
678 $ cd dir
679 $ hg log -f -L path:foo,5:7 -p
679 $ hg log -f -L path:foo,5:7 -p
680 changeset: 5:cfdf972b3971
680 changeset: 5:cfdf972b3971
681 user: test
681 user: test
682 date: Thu Jan 01 00:00:00 1970 +0000
682 date: Thu Jan 01 00:00:00 1970 +0000
683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684
684
685 diff --git a/foo b/foo
685 diff --git a/foo b/foo
686 --- a/foo
686 --- a/foo
687 +++ b/foo
687 +++ b/foo
688 @@ -4,7 +4,7 @@
688 @@ -4,7 +4,7 @@
689 0
689 0
690 1
690 1
691 2+
691 2+
692 -3
692 -3
693 +3+
693 +3+
694 4
694 4
695 5
695 5
696 6
696 6
697
697
698 changeset: 4:eaec41c1a0c9
698 changeset: 4:eaec41c1a0c9
699 user: test
699 user: test
700 date: Thu Jan 01 00:00:00 1970 +0000
700 date: Thu Jan 01 00:00:00 1970 +0000
701 summary: 11 -> 11+; leading space before "1"
701 summary: 11 -> 11+; leading space before "1"
702
702
703 diff --git a/foo b/foo
703 diff --git a/foo b/foo
704 --- a/foo
704 --- a/foo
705 +++ b/foo
705 +++ b/foo
706 @@ -2,7 +2,7 @@
706 @@ -2,7 +2,7 @@
707 0
707 0
708 0
708 0
709 0
709 0
710 -1
710 -1
711 + 1
711 + 1
712 2+
712 2+
713 3
713 3
714 4
714 4
715
715
716 changeset: 2:63a884426fd0
716 changeset: 2:63a884426fd0
717 user: test
717 user: test
718 date: Thu Jan 01 00:00:00 1970 +0000
718 date: Thu Jan 01 00:00:00 1970 +0000
719 summary: 2 -> 2+; added bar
719 summary: 2 -> 2+; added bar
720
720
721 diff --git a/foo b/foo
721 diff --git a/foo b/foo
722 --- a/foo
722 --- a/foo
723 +++ b/foo
723 +++ b/foo
724 @@ -3,6 +3,6 @@
724 @@ -3,6 +3,6 @@
725 0
725 0
726 0
726 0
727 1
727 1
728 -2
728 -2
729 +2+
729 +2+
730 3
730 3
731 4
731 4
732
732
733 changeset: 0:5ae1f82b9a00
733 changeset: 0:5ae1f82b9a00
734 user: test
734 user: test
735 date: Thu Jan 01 00:00:00 1970 +0000
735 date: Thu Jan 01 00:00:00 1970 +0000
736 summary: init
736 summary: init
737
737
738 diff --git a/foo b/foo
738 diff --git a/foo b/foo
739 new file mode 100644
739 new file mode 100644
740 --- /dev/null
740 --- /dev/null
741 +++ b/foo
741 +++ b/foo
742 @@ -0,0 +1,5 @@
742 @@ -0,0 +1,5 @@
743 +0
743 +0
744 +1
744 +1
745 +2
745 +2
746 +3
746 +3
747 +4
747 +4
748
748
749
749
750 Renames are followed.
750 Renames are followed.
751
751
752 $ hg mv ../foo baz
752 $ hg mv ../foo baz
753 $ sed 's/1/1+/' baz > baz.new
753 $ sed 's/1/1+/' baz > baz.new
754 $ mv baz.new baz
754 $ mv baz.new baz
755 $ hg ci -m 'foo -> dir/baz; 1-1+'
755 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 $ hg diff -c .
756 $ hg diff -c .
757 diff --git a/foo b/dir/baz
757 diff --git a/foo b/dir/baz
758 rename from foo
758 rename from foo
759 rename to dir/baz
759 rename to dir/baz
760 --- a/foo
760 --- a/foo
761 +++ b/dir/baz
761 +++ b/dir/baz
762 @@ -2,7 +2,7 @@
762 @@ -2,7 +2,7 @@
763 0
763 0
764 0
764 0
765 0
765 0
766 - 1
766 - 1
767 + 1+
767 + 1+
768 2+
768 2+
769 3+
769 3+
770 4
770 4
771 @@ -11,5 +11,5 @@
771 @@ -11,5 +11,5 @@
772 7
772 7
773 8
773 8
774 9
774 9
775 -10
775 -10
776 -11-
776 -11-
777 +1+0
777 +1+0
778 +1+1-
778 +1+1-
779 $ hg log -f -L relpath:baz,5:7 -p
779 $ hg log -f -L relpath:baz,5:7 -p
780 changeset: 9:6af29c3a778f
780 changeset: 9:6af29c3a778f
781 tag: tip
781 tag: tip
782 user: test
782 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000
783 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: foo -> dir/baz; 1-1+
784 summary: foo -> dir/baz; 1-1+
785
785
786 diff --git a/foo b/dir/baz
786 diff --git a/foo b/dir/baz
787 copy from foo
787 copy from foo
788 copy to dir/baz
788 copy to dir/baz
789 --- a/foo
789 --- a/foo
790 +++ b/dir/baz
790 +++ b/dir/baz
791 @@ -2,7 +2,7 @@
791 @@ -2,7 +2,7 @@
792 0
792 0
793 0
793 0
794 0
794 0
795 - 1
795 - 1
796 + 1+
796 + 1+
797 2+
797 2+
798 3+
798 3+
799 4
799 4
800
800
801 changeset: 5:cfdf972b3971
801 changeset: 5:cfdf972b3971
802 user: test
802 user: test
803 date: Thu Jan 01 00:00:00 1970 +0000
803 date: Thu Jan 01 00:00:00 1970 +0000
804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805
805
806 diff --git a/foo b/foo
806 diff --git a/foo b/foo
807 --- a/foo
807 --- a/foo
808 +++ b/foo
808 +++ b/foo
809 @@ -4,7 +4,7 @@
809 @@ -4,7 +4,7 @@
810 0
810 0
811 1
811 1
812 2+
812 2+
813 -3
813 -3
814 +3+
814 +3+
815 4
815 4
816 5
816 5
817 6
817 6
818
818
819 changeset: 4:eaec41c1a0c9
819 changeset: 4:eaec41c1a0c9
820 user: test
820 user: test
821 date: Thu Jan 01 00:00:00 1970 +0000
821 date: Thu Jan 01 00:00:00 1970 +0000
822 summary: 11 -> 11+; leading space before "1"
822 summary: 11 -> 11+; leading space before "1"
823
823
824 diff --git a/foo b/foo
824 diff --git a/foo b/foo
825 --- a/foo
825 --- a/foo
826 +++ b/foo
826 +++ b/foo
827 @@ -2,7 +2,7 @@
827 @@ -2,7 +2,7 @@
828 0
828 0
829 0
829 0
830 0
830 0
831 -1
831 -1
832 + 1
832 + 1
833 2+
833 2+
834 3
834 3
835 4
835 4
836
836
837 changeset: 2:63a884426fd0
837 changeset: 2:63a884426fd0
838 user: test
838 user: test
839 date: Thu Jan 01 00:00:00 1970 +0000
839 date: Thu Jan 01 00:00:00 1970 +0000
840 summary: 2 -> 2+; added bar
840 summary: 2 -> 2+; added bar
841
841
842 diff --git a/foo b/foo
842 diff --git a/foo b/foo
843 --- a/foo
843 --- a/foo
844 +++ b/foo
844 +++ b/foo
845 @@ -3,6 +3,6 @@
845 @@ -3,6 +3,6 @@
846 0
846 0
847 0
847 0
848 1
848 1
849 -2
849 -2
850 +2+
850 +2+
851 3
851 3
852 4
852 4
853
853
854 changeset: 0:5ae1f82b9a00
854 changeset: 0:5ae1f82b9a00
855 user: test
855 user: test
856 date: Thu Jan 01 00:00:00 1970 +0000
856 date: Thu Jan 01 00:00:00 1970 +0000
857 summary: init
857 summary: init
858
858
859 diff --git a/foo b/foo
859 diff --git a/foo b/foo
860 new file mode 100644
860 new file mode 100644
861 --- /dev/null
861 --- /dev/null
862 +++ b/foo
862 +++ b/foo
863 @@ -0,0 +1,5 @@
863 @@ -0,0 +1,5 @@
864 +0
864 +0
865 +1
865 +1
866 +2
866 +2
867 +3
867 +3
868 +4
868 +4
869
869
870
870
871 Copies.
872
873 $ hg copy baz bbaz
874 $ sed 's/6/6+/' bbaz > bbaz.new
875 $ mv bbaz.new bbaz
876 $ hg commit -m 'cp baz bbaz; 6-6+'
877 $ hg diff -c .
878 diff --git a/dir/baz b/dir/bbaz
879 copy from dir/baz
880 copy to dir/bbaz
881 --- a/dir/baz
882 +++ b/dir/bbaz
883 @@ -7,7 +7,7 @@
884 3+
885 4
886 5
887 -6
888 +6+
889 7
890 8
891 9
892 $ hg log --copies -f -L bbaz,10:11 -p
893 changeset: 10:91a3d3b6c546
894 tag: tip
895 user: test
896 date: Thu Jan 01 00:00:00 1970 +0000
897 summary: cp baz bbaz; 6-6+
898
899 diff --git a/dir/baz b/dir/bbaz
900 copy from dir/baz
901 copy to dir/bbaz
902 --- a/dir/baz
903 +++ b/dir/bbaz
904 @@ -7,7 +7,7 @@
905 3+
906 4
907 5
908 -6
909 +6+
910 7
911 8
912 9
913
914 changeset: 3:730a61fbaecf
915 user: test
916 date: Thu Jan 01 00:00:00 1970 +0000
917 summary: to 11
918
919 diff --git a/foo b/foo
920 --- a/foo
921 +++ b/foo
922 @@ -6,3 +6,10 @@
923 2+
924 3
925 4
926 +5
927 +6
928 +7
929 +8
930 +9
931 +10
932 +11
933
934 $ hg log -f -L bbaz,10:11 -p
935 changeset: 10:91a3d3b6c546
936 tag: tip
937 user: test
938 date: Thu Jan 01 00:00:00 1970 +0000
939 summary: cp baz bbaz; 6-6+
940
941 diff --git a/dir/baz b/dir/bbaz
942 copy from dir/baz
943 copy to dir/bbaz
944 --- a/dir/baz
945 +++ b/dir/bbaz
946 @@ -7,7 +7,7 @@
947 3+
948 4
949 5
950 -6
951 +6+
952 7
953 8
954 9
955
956 changeset: 3:730a61fbaecf
957 user: test
958 date: Thu Jan 01 00:00:00 1970 +0000
959 summary: to 11
960
961 diff --git a/foo b/foo
962 --- a/foo
963 +++ b/foo
964 @@ -6,3 +6,10 @@
965 2+
966 3
967 4
968 +5
969 +6
970 +7
971 +8
972 +9
973 +10
974 +11
975
976
871 Binary files work but without diff hunks filtering.
977 Binary files work but without diff hunks filtering.
872 (Checking w/ and w/o diff.git option.)
978 (Checking w/ and w/o diff.git option.)
873
979
874 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
980 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
875 $ hg add binary
981 $ hg add binary
876 $ hg ci -m 'add a binary file' --quiet
982 $ hg ci -m 'add a binary file' --quiet
877 $ hg log -f -L binary,1:2 -p
983 $ hg log -f -L binary,1:2 -p
878 changeset: 10:c96381c229df
984 changeset: 11:dc865b608edf
879 tag: tip
985 tag: tip
880 user: test
986 user: test
881 date: Thu Jan 01 00:00:00 1970 +0000
987 date: Thu Jan 01 00:00:00 1970 +0000
882 summary: add a binary file
988 summary: add a binary file
883
989
884 diff --git a/dir/binary b/dir/binary
990 diff --git a/dir/binary b/dir/binary
885 new file mode 100644
991 new file mode 100644
886 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45
992 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45
887 GIT binary patch
993 GIT binary patch
888 literal 17
994 literal 17
889 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
995 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
890
996
891
997
892 $ hg log -f -L binary,1:2 -p --config diff.git=false
998 $ hg log -f -L binary,1:2 -p --config diff.git=false
893 changeset: 10:c96381c229df
999 changeset: 11:dc865b608edf
894 tag: tip
1000 tag: tip
895 user: test
1001 user: test
896 date: Thu Jan 01 00:00:00 1970 +0000
1002 date: Thu Jan 01 00:00:00 1970 +0000
897 summary: add a binary file
1003 summary: add a binary file
898
1004
899 diff -r 6af29c3a778f -r c96381c229df dir/binary
1005 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
900 Binary file dir/binary has changed
1006 Binary file dir/binary has changed
901
1007
902
1008
903 Option --follow is required.
1009 Option --follow is required.
904
1010
905 $ hg log -L foo,5:7
1011 $ hg log -L foo,5:7
906 abort: --line-range requires --follow
1012 abort: --line-range requires --follow
907 [255]
1013 [255]
908
1014
909 Non-exact pattern kinds are not allowed.
1015 Non-exact pattern kinds are not allowed.
910
1016
911 $ cd ..
1017 $ cd ..
912 $ hg log -f -L glob:*a*,1:2
1018 $ hg log -f -L glob:*a*,1:2
913 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1019 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
914 [255]
1020 [255]
915
1021
916 We get an error for removed files.
1022 We get an error for removed files.
917
1023
918 $ hg rm dir/baz
1024 $ hg rm dir/baz
919 $ hg ci -m 'remove baz' --quiet
1025 $ hg ci -m 'remove baz' --quiet
920 $ hg log -f -L dir/baz,5:7 -p
1026 $ hg log -f -L dir/baz,5:7 -p
921 abort: cannot follow file not in parent revision: "dir/baz"
1027 abort: cannot follow file not in parent revision: "dir/baz"
922 [255]
1028 [255]
General Comments 0
You need to be logged in to leave comments. Login now