##// END OF EJS Templates
tests: make merge conflicts explicit in `hg annotate` tests...
Martin von Zweigbergk -
r42327:7116fc61 default
parent child Browse files
Show More
@@ -1,1080 +1,1210 b''
1 $ HGMERGE=true; export HGMERGE
1 $ cat >> "$HGRCPATH" << EOF
2 > [ui]
3 > merge = :merge3
4 > EOF
2
5
3 init
6 init
4
7
5 $ hg init repo
8 $ hg init repo
6 $ cd repo
9 $ cd repo
7
10
8 commit
11 commit
9
12
10 $ echo 'a' > a
13 $ echo 'a' > a
11 $ hg ci -A -m test -u nobody -d '1 0'
14 $ hg ci -A -m test -u nobody -d '1 0'
12 adding a
15 adding a
13
16
14 annotate -c
17 annotate -c
15
18
16 $ hg annotate -c a
19 $ hg annotate -c a
17 8435f90966e4: a
20 8435f90966e4: a
18
21
19 annotate -cl
22 annotate -cl
20
23
21 $ hg annotate -cl a
24 $ hg annotate -cl a
22 8435f90966e4:1: a
25 8435f90966e4:1: a
23
26
24 annotate -d
27 annotate -d
25
28
26 $ hg annotate -d a
29 $ hg annotate -d a
27 Thu Jan 01 00:00:01 1970 +0000: a
30 Thu Jan 01 00:00:01 1970 +0000: a
28
31
29 annotate -n
32 annotate -n
30
33
31 $ hg annotate -n a
34 $ hg annotate -n a
32 0: a
35 0: a
33
36
34 annotate -nl
37 annotate -nl
35
38
36 $ hg annotate -nl a
39 $ hg annotate -nl a
37 0:1: a
40 0:1: a
38
41
39 annotate -u
42 annotate -u
40
43
41 $ hg annotate -u a
44 $ hg annotate -u a
42 nobody: a
45 nobody: a
43
46
44 annotate -cdnu
47 annotate -cdnu
45
48
46 $ hg annotate -cdnu a
49 $ hg annotate -cdnu a
47 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
50 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
48
51
49 annotate -cdnul
52 annotate -cdnul
50
53
51 $ hg annotate -cdnul a
54 $ hg annotate -cdnul a
52 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
55 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
53
56
54 annotate (JSON)
57 annotate (JSON)
55
58
56 $ hg annotate -Tjson a
59 $ hg annotate -Tjson a
57 [
60 [
58 {
61 {
59 "lines": [{"line": "a\n", "rev": 0}],
62 "lines": [{"line": "a\n", "rev": 0}],
60 "path": "a"
63 "path": "a"
61 }
64 }
62 ]
65 ]
63
66
64 $ hg annotate -Tjson -cdfnul a
67 $ hg annotate -Tjson -cdfnul a
65 [
68 [
66 {
69 {
67 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
70 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
68 "path": "a"
71 "path": "a"
69 }
72 }
70 ]
73 ]
71
74
72 log-like templating
75 log-like templating
73
76
74 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
77 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
75 0 8435: a
78 0 8435: a
76
79
77 '{lineno}' field should be populated as necessary
80 '{lineno}' field should be populated as necessary
78
81
79 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
82 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
80 0:1: a
83 0:1: a
81 $ hg annotate -Ta a \
84 $ hg annotate -Ta a \
82 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
85 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
83 0:1: a
86 0:1: a
84
87
85 $ cat <<EOF >>a
88 $ cat <<EOF >>a
86 > a
89 > a
87 > a
90 > a
88 > EOF
91 > EOF
89 $ hg ci -ma1 -d '1 0'
92 $ hg ci -ma1 -d '1 0'
90 $ hg cp a b
93 $ hg cp a b
91 $ hg ci -mb -d '1 0'
94 $ hg ci -mb -d '1 0'
92 $ cat <<EOF >> b
95 $ cat <<EOF >> b
93 > b4
96 > b4
94 > b5
97 > b5
95 > b6
98 > b6
96 > EOF
99 > EOF
97 $ hg ci -mb2 -d '2 0'
100 $ hg ci -mb2 -d '2 0'
98
101
99 default output of '{lines}' should be readable
102 default output of '{lines}' should be readable
100
103
101 $ hg annotate -T'{lines}' a
104 $ hg annotate -T'{lines}' a
102 0: a
105 0: a
103 1: a
106 1: a
104 1: a
107 1: a
105 $ hg annotate -T'{join(lines, "\n")}' a
108 $ hg annotate -T'{join(lines, "\n")}' a
106 0: a
109 0: a
107
110
108 1: a
111 1: a
109
112
110 1: a
113 1: a
111
114
112 several filters can be applied to '{lines}'
115 several filters can be applied to '{lines}'
113
116
114 $ hg annotate -T'{lines|json}\n' a
117 $ hg annotate -T'{lines|json}\n' a
115 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
118 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
116 $ hg annotate -T'{lines|stringify}' a
119 $ hg annotate -T'{lines|stringify}' a
117 0: a
120 0: a
118 1: a
121 1: a
119 1: a
122 1: a
120 $ hg annotate -T'{lines|count}\n' a
123 $ hg annotate -T'{lines|count}\n' a
121 3
124 3
122
125
123 annotate multiple files (JSON)
126 annotate multiple files (JSON)
124
127
125 $ hg annotate -Tjson a b
128 $ hg annotate -Tjson a b
126 [
129 [
127 {
130 {
128 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
131 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
129 "path": "a"
132 "path": "a"
130 },
133 },
131 {
134 {
132 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
135 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
133 "path": "b"
136 "path": "b"
134 }
137 }
135 ]
138 ]
136
139
137 annotate multiple files (template)
140 annotate multiple files (template)
138
141
139 $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b
142 $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b
140 == a ==
143 == a ==
141 0: a
144 0: a
142 1: a
145 1: a
143 1: a
146 1: a
144 == b ==
147 == b ==
145 0: a
148 0: a
146 1: a
149 1: a
147 1: a
150 1: a
148 3: b4
151 3: b4
149 3: b5
152 3: b5
150 3: b6
153 3: b6
151
154
152 annotate -n b
155 annotate -n b
153
156
154 $ hg annotate -n b
157 $ hg annotate -n b
155 0: a
158 0: a
156 1: a
159 1: a
157 1: a
160 1: a
158 3: b4
161 3: b4
159 3: b5
162 3: b5
160 3: b6
163 3: b6
161
164
162 annotate --no-follow b
165 annotate --no-follow b
163
166
164 $ hg annotate --no-follow b
167 $ hg annotate --no-follow b
165 2: a
168 2: a
166 2: a
169 2: a
167 2: a
170 2: a
168 3: b4
171 3: b4
169 3: b5
172 3: b5
170 3: b6
173 3: b6
171
174
172 annotate -nl b
175 annotate -nl b
173
176
174 $ hg annotate -nl b
177 $ hg annotate -nl b
175 0:1: a
178 0:1: a
176 1:2: a
179 1:2: a
177 1:3: a
180 1:3: a
178 3:4: b4
181 3:4: b4
179 3:5: b5
182 3:5: b5
180 3:6: b6
183 3:6: b6
181
184
182 annotate -nf b
185 annotate -nf b
183
186
184 $ hg annotate -nf b
187 $ hg annotate -nf b
185 0 a: a
188 0 a: a
186 1 a: a
189 1 a: a
187 1 a: a
190 1 a: a
188 3 b: b4
191 3 b: b4
189 3 b: b5
192 3 b: b5
190 3 b: b6
193 3 b: b6
191
194
192 annotate -nlf b
195 annotate -nlf b
193
196
194 $ hg annotate -nlf b
197 $ hg annotate -nlf b
195 0 a:1: a
198 0 a:1: a
196 1 a:2: a
199 1 a:2: a
197 1 a:3: a
200 1 a:3: a
198 3 b:4: b4
201 3 b:4: b4
199 3 b:5: b5
202 3 b:5: b5
200 3 b:6: b6
203 3 b:6: b6
201
204
202 $ hg up -C 2
205 $ hg up -C 2
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 $ cat <<EOF >> b
207 $ cat <<EOF >> b
205 > b4
208 > b4
206 > c
209 > c
207 > b5
210 > b5
208 > EOF
211 > EOF
209 $ hg ci -mb2.1 -d '2 0'
212 $ hg ci -mb2.1 -d '2 0'
210 created new head
213 created new head
211 $ hg merge
214 $ hg merge
212 merging b
215 merging b
213 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
216 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
214 (branch merge, don't forget to commit)
217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
218 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
219 [1]
220 $ cat b
221 a
222 a
223 a
224 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
225 b4
226 c
227 b5
228 ||||||| base
229 =======
230 b4
231 b5
232 b6
233 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
234 $ cat <<EOF > b
235 > a
236 > a
237 > a
238 > b4
239 > c
240 > b5
241 > EOF
242 $ hg resolve --mark -q
243 $ rm b.orig
215 $ hg ci -mmergeb -d '3 0'
244 $ hg ci -mmergeb -d '3 0'
216
245
217 annotate after merge
246 annotate after merge
218
247
219 $ hg annotate -nf b
248 $ hg annotate -nf b
220 0 a: a
249 0 a: a
221 1 a: a
250 1 a: a
222 1 a: a
251 1 a: a
223 3 b: b4
252 3 b: b4
224 4 b: c
253 4 b: c
225 3 b: b5
254 3 b: b5
226
255
227 annotate after merge with -l
256 annotate after merge with -l
228
257
229 $ hg annotate -nlf b
258 $ hg annotate -nlf b
230 0 a:1: a
259 0 a:1: a
231 1 a:2: a
260 1 a:2: a
232 1 a:3: a
261 1 a:3: a
233 3 b:4: b4
262 3 b:4: b4
234 4 b:5: c
263 4 b:5: c
235 3 b:5: b5
264 3 b:5: b5
236
265
237 $ hg up -C 1
266 $ hg up -C 1
238 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
239 $ hg cp a b
268 $ hg cp a b
240 $ cat <<EOF > b
269 $ cat <<EOF > b
241 > a
270 > a
242 > z
271 > z
243 > a
272 > a
244 > EOF
273 > EOF
245 $ hg ci -mc -d '3 0'
274 $ hg ci -mc -d '3 0'
246 created new head
275 created new head
276 BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
247 $ hg merge
277 $ hg merge
248 merging b
278 merging b
249 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
279 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
250 (branch merge, don't forget to commit)
280 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
251 $ cat <<EOF >> b
281 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
282 [1]
283 $ cat b
284 <<<<<<< working copy: b80e3e32f75a - test: c
285 a
286 z
287 a
288 ||||||| base
289 =======
290 a
291 a
292 a
293 b4
294 c
295 b5
296 >>>>>>> merge rev: 64afcdf8e29e - test: mergeb
297 $ cat <<EOF > b
298 > a
299 > z
300 > a
252 > b4
301 > b4
253 > c
302 > c
254 > b5
303 > b5
255 > EOF
304 > EOF
305 $ hg resolve --mark -q
306 $ rm b.orig
256 $ echo d >> b
307 $ echo d >> b
257 $ hg ci -mmerge2 -d '4 0'
308 $ hg ci -mmerge2 -d '4 0'
258
309
259 annotate after rename merge
310 annotate after rename merge
260
311
261 $ hg annotate -nf b
312 $ hg annotate -nf b
262 0 a: a
313 0 a: a
263 6 b: z
314 6 b: z
264 1 a: a
315 1 a: a
265 3 b: b4
316 3 b: b4
266 4 b: c
317 4 b: c
267 3 b: b5
318 3 b: b5
268 7 b: d
319 7 b: d
269
320
270 annotate after rename merge with -l
321 annotate after rename merge with -l
271
322
272 $ hg annotate -nlf b
323 $ hg annotate -nlf b
273 0 a:1: a
324 0 a:1: a
274 6 b:2: z
325 6 b:2: z
275 1 a:3: a
326 1 a:3: a
276 3 b:4: b4
327 3 b:4: b4
277 4 b:5: c
328 4 b:5: c
278 3 b:5: b5
329 3 b:5: b5
279 7 b:7: d
330 7 b:7: d
280
331
281 --skip nothing (should be the same as no --skip at all)
332 --skip nothing (should be the same as no --skip at all)
282
333
283 $ hg annotate -nlf b --skip '1::0'
334 $ hg annotate -nlf b --skip '1::0'
284 0 a:1: a
335 0 a:1: a
285 6 b:2: z
336 6 b:2: z
286 1 a:3: a
337 1 a:3: a
287 3 b:4: b4
338 3 b:4: b4
288 4 b:5: c
339 4 b:5: c
289 3 b:5: b5
340 3 b:5: b5
290 7 b:7: d
341 7 b:7: d
291
342
292 --skip a modified line. Note a slight behavior difference in pure - this is
343 --skip a modified line. Note a slight behavior difference in pure - this is
293 because the pure code comes up with slightly different deltas internally.
344 because the pure code comes up with slightly different deltas internally.
294
345
295 $ hg annotate -nlf b --skip 6
346 $ hg annotate -nlf b --skip 6
296 0 a:1: a
347 0 a:1: a
297 1 a:2* z (no-pure !)
348 1 a:2* z (no-pure !)
298 0 a:1* z (pure !)
349 0 a:1* z (pure !)
299 1 a:3: a
350 1 a:3: a
300 3 b:4: b4
351 3 b:4: b4
301 4 b:5: c
352 4 b:5: c
302 3 b:5: b5
353 3 b:5: b5
303 7 b:7: d
354 7 b:7: d
304
355
305 --skip added lines (and test multiple skip)
356 --skip added lines (and test multiple skip)
306
357
307 $ hg annotate -nlf b --skip 3
358 $ hg annotate -nlf b --skip 3
308 0 a:1: a
359 0 a:1: a
309 6 b:2: z
360 6 b:2: z
310 1 a:3: a
361 1 a:3: a
311 1 a:3* b4
362 1 a:3* b4
312 4 b:5: c
363 4 b:5: c
313 1 a:3* b5
364 1 a:3* b5
314 7 b:7: d
365 7 b:7: d
315
366
316 $ hg annotate -nlf b --skip 4
367 $ hg annotate -nlf b --skip 4
317 0 a:1: a
368 0 a:1: a
318 6 b:2: z
369 6 b:2: z
319 1 a:3: a
370 1 a:3: a
320 3 b:4: b4
371 3 b:4: b4
321 1 a:3* c
372 1 a:3* c
322 3 b:5: b5
373 3 b:5: b5
323 7 b:7: d
374 7 b:7: d
324
375
325 $ hg annotate -nlf b --skip 3 --skip 4
376 $ hg annotate -nlf b --skip 3 --skip 4
326 0 a:1: a
377 0 a:1: a
327 6 b:2: z
378 6 b:2: z
328 1 a:3: a
379 1 a:3: a
329 1 a:3* b4
380 1 a:3* b4
330 1 a:3* c
381 1 a:3* c
331 1 a:3* b5
382 1 a:3* b5
332 7 b:7: d
383 7 b:7: d
333
384
334 $ hg annotate -nlf b --skip 'merge()'
385 $ hg annotate -nlf b --skip 'merge()'
335 0 a:1: a
386 0 a:1: a
336 6 b:2: z
387 6 b:2: z
337 1 a:3: a
388 1 a:3: a
338 3 b:4: b4
389 3 b:4: b4
339 4 b:5: c
390 4 b:5: c
340 3 b:5: b5
391 3 b:5: b5
341 3 b:5* d
392 3 b:5* d
342
393
343 --skip everything -- use the revision the file was introduced in
394 --skip everything -- use the revision the file was introduced in
344
395
345 $ hg annotate -nlf b --skip 'all()'
396 $ hg annotate -nlf b --skip 'all()'
346 0 a:1: a
397 0 a:1: a
347 0 a:1* z
398 0 a:1* z
348 0 a:1* a
399 0 a:1* a
349 0 a:1* b4
400 0 a:1* b4
350 0 a:1* c
401 0 a:1* c
351 0 a:1* b5
402 0 a:1* b5
352 0 a:1* d
403 0 a:1* d
353
404
354 Issue2807: alignment of line numbers with -l
405 Issue2807: alignment of line numbers with -l
355
406
356 $ echo more >> b
407 $ echo more >> b
357 $ hg ci -mmore -d '5 0'
408 $ hg ci -mmore -d '5 0'
358 $ echo more >> b
409 $ echo more >> b
359 $ hg ci -mmore -d '6 0'
410 $ hg ci -mmore -d '6 0'
360 $ echo more >> b
411 $ echo more >> b
361 $ hg ci -mmore -d '7 0'
412 $ hg ci -mmore -d '7 0'
362 $ hg annotate -nlf b
413 $ hg annotate -nlf b
363 0 a: 1: a
414 0 a: 1: a
364 6 b: 2: z
415 6 b: 2: z
365 1 a: 3: a
416 1 a: 3: a
366 3 b: 4: b4
417 3 b: 4: b4
367 4 b: 5: c
418 4 b: 5: c
368 3 b: 5: b5
419 3 b: 5: b5
369 7 b: 7: d
420 7 b: 7: d
370 8 b: 8: more
421 8 b: 8: more
371 9 b: 9: more
422 9 b: 9: more
372 10 b:10: more
423 10 b:10: more
373
424
374 linkrev vs rev
425 linkrev vs rev
375
426
376 $ hg annotate -r tip -n a
427 $ hg annotate -r tip -n a
377 0: a
428 0: a
378 1: a
429 1: a
379 1: a
430 1: a
380
431
381 linkrev vs rev with -l
432 linkrev vs rev with -l
382
433
383 $ hg annotate -r tip -nl a
434 $ hg annotate -r tip -nl a
384 0:1: a
435 0:1: a
385 1:2: a
436 1:2: a
386 1:3: a
437 1:3: a
387
438
388 Issue589: "undelete" sequence leads to crash
439 Issue589: "undelete" sequence leads to crash
389
440
390 annotate was crashing when trying to --follow something
441 annotate was crashing when trying to --follow something
391
442
392 like A -> B -> A
443 like A -> B -> A
393
444
394 generate ABA rename configuration
445 generate ABA rename configuration
395
446
396 $ echo foo > foo
447 $ echo foo > foo
397 $ hg add foo
448 $ hg add foo
398 $ hg ci -m addfoo
449 $ hg ci -m addfoo
399 $ hg rename foo bar
450 $ hg rename foo bar
400 $ hg ci -m renamefoo
451 $ hg ci -m renamefoo
401 $ hg rename bar foo
452 $ hg rename bar foo
402 $ hg ci -m renamebar
453 $ hg ci -m renamebar
403
454
404 annotate after ABA with follow
455 annotate after ABA with follow
405
456
406 $ hg annotate --follow foo
457 $ hg annotate --follow foo
407 foo: foo
458 foo: foo
408
459
409 missing file
460 missing file
410
461
411 $ hg ann nosuchfile
462 $ hg ann nosuchfile
412 abort: nosuchfile: no such file in rev e9e6b4fa872f
463 abort: nosuchfile: no such file in rev e9e6b4fa872f
413 [255]
464 [255]
414
465
415 annotate file without '\n' on last line
466 annotate file without '\n' on last line
416
467
417 $ printf "" > c
468 $ printf "" > c
418 $ hg ci -A -m test -u nobody -d '1 0'
469 $ hg ci -A -m test -u nobody -d '1 0'
419 adding c
470 adding c
420 $ hg annotate c
471 $ hg annotate c
421 $ printf "a\nb" > c
472 $ printf "a\nb" > c
422 $ hg ci -m test
473 $ hg ci -m test
423 $ hg annotate c
474 $ hg annotate c
424 [0-9]+: a (re)
475 [0-9]+: a (re)
425 [0-9]+: b (re)
476 [0-9]+: b (re)
426
477
427 Issue3841: check annotation of the file of which filelog includes
478 Issue3841: check annotation of the file of which filelog includes
428 merging between the revision and its ancestor
479 merging between the revision and its ancestor
429
480
430 to reproduce the situation with recent Mercurial, this script uses (1)
481 to reproduce the situation with recent Mercurial, this script uses (1)
431 "hg debugsetparents" to merge without ancestor check by "hg merge",
482 "hg debugsetparents" to merge without ancestor check by "hg merge",
432 and (2) the extension to allow filelog merging between the revision
483 and (2) the extension to allow filelog merging between the revision
433 and its ancestor by overriding "repo._filecommit".
484 and its ancestor by overriding "repo._filecommit".
434
485
435 $ cat > ../legacyrepo.py <<EOF
486 $ cat > ../legacyrepo.py <<EOF
436 > from __future__ import absolute_import
487 > from __future__ import absolute_import
437 > from mercurial import error, node
488 > from mercurial import error, node
438 > def reposetup(ui, repo):
489 > def reposetup(ui, repo):
439 > class legacyrepo(repo.__class__):
490 > class legacyrepo(repo.__class__):
440 > def _filecommit(self, fctx, manifest1, manifest2,
491 > def _filecommit(self, fctx, manifest1, manifest2,
441 > linkrev, tr, changelist, includecopymeta):
492 > linkrev, tr, changelist, includecopymeta):
442 > fname = fctx.path()
493 > fname = fctx.path()
443 > text = fctx.data()
494 > text = fctx.data()
444 > flog = self.file(fname)
495 > flog = self.file(fname)
445 > fparent1 = manifest1.get(fname, node.nullid)
496 > fparent1 = manifest1.get(fname, node.nullid)
446 > fparent2 = manifest2.get(fname, node.nullid)
497 > fparent2 = manifest2.get(fname, node.nullid)
447 > meta = {}
498 > meta = {}
448 > copy = fctx.copysource()
499 > copy = fctx.copysource()
449 > if copy and copy != fname:
500 > if copy and copy != fname:
450 > raise error.Abort('copying is not supported')
501 > raise error.Abort('copying is not supported')
451 > if fparent2 != node.nullid:
502 > if fparent2 != node.nullid:
452 > changelist.append(fname)
503 > changelist.append(fname)
453 > return flog.add(text, meta, tr, linkrev,
504 > return flog.add(text, meta, tr, linkrev,
454 > fparent1, fparent2)
505 > fparent1, fparent2)
455 > raise error.Abort('only merging is supported')
506 > raise error.Abort('only merging is supported')
456 > repo.__class__ = legacyrepo
507 > repo.__class__ = legacyrepo
457 > EOF
508 > EOF
458
509
459 $ cat > baz <<EOF
510 $ cat > baz <<EOF
460 > 1
511 > 1
461 > 2
512 > 2
462 > 3
513 > 3
463 > 4
514 > 4
464 > 5
515 > 5
465 > EOF
516 > EOF
466 $ hg add baz
517 $ hg add baz
467 $ hg commit -m "baz:0"
518 $ hg commit -m "baz:0"
468
519
469 $ cat > baz <<EOF
520 $ cat > baz <<EOF
470 > 1 baz:1
521 > 1 baz:1
471 > 2
522 > 2
472 > 3
523 > 3
473 > 4
524 > 4
474 > 5
525 > 5
475 > EOF
526 > EOF
476 $ hg commit -m "baz:1"
527 $ hg commit -m "baz:1"
477
528
478 $ cat > baz <<EOF
529 $ cat > baz <<EOF
479 > 1 baz:1
530 > 1 baz:1
480 > 2 baz:2
531 > 2 baz:2
481 > 3
532 > 3
482 > 4
533 > 4
483 > 5
534 > 5
484 > EOF
535 > EOF
485 $ hg debugsetparents 17 17
536 $ hg debugsetparents 17 17
486 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
537 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
487 $ hg debugindexdot baz
538 $ hg debugindexdot baz
488 digraph G {
539 digraph G {
489 -1 -> 0
540 -1 -> 0
490 0 -> 1
541 0 -> 1
491 1 -> 2
542 1 -> 2
492 1 -> 2
543 1 -> 2
493 }
544 }
494 $ hg annotate baz
545 $ hg annotate baz
495 17: 1 baz:1
546 17: 1 baz:1
496 18: 2 baz:2
547 18: 2 baz:2
497 16: 3
548 16: 3
498 16: 4
549 16: 4
499 16: 5
550 16: 5
500
551
501 $ cat > baz <<EOF
552 $ cat > baz <<EOF
502 > 1 baz:1
553 > 1 baz:1
503 > 2 baz:2
554 > 2 baz:2
504 > 3 baz:3
555 > 3 baz:3
505 > 4
556 > 4
506 > 5
557 > 5
507 > EOF
558 > EOF
508 $ hg commit -m "baz:3"
559 $ hg commit -m "baz:3"
509
560
510 $ cat > baz <<EOF
561 $ cat > baz <<EOF
511 > 1 baz:1
562 > 1 baz:1
512 > 2 baz:2
563 > 2 baz:2
513 > 3 baz:3
564 > 3 baz:3
514 > 4 baz:4
565 > 4 baz:4
515 > 5
566 > 5
516 > EOF
567 > EOF
517 $ hg debugsetparents 19 18
568 $ hg debugsetparents 19 18
518 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
569 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
519 $ hg debugindexdot baz
570 $ hg debugindexdot baz
520 digraph G {
571 digraph G {
521 -1 -> 0
572 -1 -> 0
522 0 -> 1
573 0 -> 1
523 1 -> 2
574 1 -> 2
524 1 -> 2
575 1 -> 2
525 2 -> 3
576 2 -> 3
526 3 -> 4
577 3 -> 4
527 2 -> 4
578 2 -> 4
528 }
579 }
529 $ hg annotate baz
580 $ hg annotate baz
530 17: 1 baz:1
581 17: 1 baz:1
531 18: 2 baz:2
582 18: 2 baz:2
532 19: 3 baz:3
583 19: 3 baz:3
533 20: 4 baz:4
584 20: 4 baz:4
534 16: 5
585 16: 5
535
586
536 annotate clean file
587 annotate clean file
537
588
538 $ hg annotate -ncr "wdir()" foo
589 $ hg annotate -ncr "wdir()" foo
539 11 472b18db256d : foo
590 11 472b18db256d : foo
540
591
541 annotate modified file
592 annotate modified file
542
593
543 $ echo foofoo >> foo
594 $ echo foofoo >> foo
544 $ hg annotate -r "wdir()" foo
595 $ hg annotate -r "wdir()" foo
545 11 : foo
596 11 : foo
546 20+: foofoo
597 20+: foofoo
547
598
548 $ hg annotate -cr "wdir()" foo
599 $ hg annotate -cr "wdir()" foo
549 472b18db256d : foo
600 472b18db256d : foo
550 b6bedd5477e7+: foofoo
601 b6bedd5477e7+: foofoo
551
602
552 $ hg annotate -ncr "wdir()" foo
603 $ hg annotate -ncr "wdir()" foo
553 11 472b18db256d : foo
604 11 472b18db256d : foo
554 20 b6bedd5477e7+: foofoo
605 20 b6bedd5477e7+: foofoo
555
606
556 $ hg annotate --debug -ncr "wdir()" foo
607 $ hg annotate --debug -ncr "wdir()" foo
557 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
608 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
558 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
609 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
559
610
560 $ hg annotate -udr "wdir()" foo
611 $ hg annotate -udr "wdir()" foo
561 test Thu Jan 01 00:00:00 1970 +0000: foo
612 test Thu Jan 01 00:00:00 1970 +0000: foo
562 test [A-Za-z0-9:+ ]+: foofoo (re)
613 test [A-Za-z0-9:+ ]+: foofoo (re)
563
614
564 $ hg annotate -ncr "wdir()" -Tjson foo
615 $ hg annotate -ncr "wdir()" -Tjson foo
565 [
616 [
566 {
617 {
567 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
618 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
568 "path": "foo"
619 "path": "foo"
569 }
620 }
570 ]
621 ]
571
622
572 annotate added file
623 annotate added file
573
624
574 $ echo bar > bar
625 $ echo bar > bar
575 $ hg add bar
626 $ hg add bar
576 $ hg annotate -ncr "wdir()" bar
627 $ hg annotate -ncr "wdir()" bar
577 20 b6bedd5477e7+: bar
628 20 b6bedd5477e7+: bar
578
629
579 annotate renamed file
630 annotate renamed file
580
631
581 $ hg rename foo renamefoo2
632 $ hg rename foo renamefoo2
582 $ hg annotate -ncr "wdir()" renamefoo2
633 $ hg annotate -ncr "wdir()" renamefoo2
583 11 472b18db256d : foo
634 11 472b18db256d : foo
584 20 b6bedd5477e7+: foofoo
635 20 b6bedd5477e7+: foofoo
585
636
586 annotate missing file
637 annotate missing file
587
638
588 $ rm baz
639 $ rm baz
589
640
590 $ hg annotate -ncr "wdir()" baz
641 $ hg annotate -ncr "wdir()" baz
591 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
642 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
592 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
643 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
593 [255]
644 [255]
594
645
595 annotate removed file
646 annotate removed file
596
647
597 $ hg rm baz
648 $ hg rm baz
598
649
599 $ hg annotate -ncr "wdir()" baz
650 $ hg annotate -ncr "wdir()" baz
600 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
651 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
601 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
652 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
602 [255]
653 [255]
603
654
604 $ hg revert --all --no-backup --quiet
655 $ hg revert --all --no-backup --quiet
605 $ hg id -n
656 $ hg id -n
606 20
657 20
607
658
608 Test followlines() revset; we usually check both followlines(pat, range) and
659 Test followlines() revset; we usually check both followlines(pat, range) and
609 followlines(pat, range, descend=True) to make sure both give the same result
660 followlines(pat, range, descend=True) to make sure both give the same result
610 when they should.
661 when they should.
611
662
612 $ echo a >> foo
663 $ echo a >> foo
613 $ hg ci -m 'foo: add a'
664 $ hg ci -m 'foo: add a'
614 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
665 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
615 16: baz:0
666 16: baz:0
616 19: baz:3
667 19: baz:3
617 20: baz:4
668 20: baz:4
618 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
669 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
619 16: baz:0
670 16: baz:0
620 19: baz:3
671 19: baz:3
621 20: baz:4
672 20: baz:4
622 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
673 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
623 16: baz:0
674 16: baz:0
624 19: baz:3
675 19: baz:3
625 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
676 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
626 19: baz:3
677 19: baz:3
627 20: baz:4
678 20: baz:4
628 $ printf "0\n0\n" | cat - baz > baz1
679 $ printf "0\n0\n" | cat - baz > baz1
629 $ mv baz1 baz
680 $ mv baz1 baz
630 $ hg ci -m 'added two lines with 0'
681 $ hg ci -m 'added two lines with 0'
631 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
682 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
632 16: baz:0
683 16: baz:0
633 19: baz:3
684 19: baz:3
634 20: baz:4
685 20: baz:4
635 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
686 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
636 19: baz:3
687 19: baz:3
637 20: baz:4
688 20: baz:4
638 $ echo 6 >> baz
689 $ echo 6 >> baz
639 $ hg ci -m 'added line 8'
690 $ hg ci -m 'added line 8'
640 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
691 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
641 16: baz:0
692 16: baz:0
642 19: baz:3
693 19: baz:3
643 20: baz:4
694 20: baz:4
644 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
695 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
645 19: baz:3
696 19: baz:3
646 20: baz:4
697 20: baz:4
647 $ sed 's/3/3+/' baz > baz.new
698 $ sed 's/3/3+/' baz > baz.new
648 $ mv baz.new baz
699 $ mv baz.new baz
649 $ hg ci -m 'baz:3->3+'
700 $ hg ci -m 'baz:3->3+'
650 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
701 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
651 16: baz:0
702 16: baz:0
652 19: baz:3
703 19: baz:3
653 20: baz:4
704 20: baz:4
654 24: baz:3->3+
705 24: baz:3->3+
655 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
706 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
656 19: baz:3
707 19: baz:3
657 20: baz:4
708 20: baz:4
658 24: baz:3->3+
709 24: baz:3->3+
659 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
710 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
660 22: added two lines with 0
711 22: added two lines with 0
661
712
662 file patterns are okay
713 file patterns are okay
663 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
714 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
664 22: added two lines with 0
715 22: added two lines with 0
665
716
666 renames are followed
717 renames are followed
667 $ hg mv baz qux
718 $ hg mv baz qux
668 $ sed 's/4/4+/' qux > qux.new
719 $ sed 's/4/4+/' qux > qux.new
669 $ mv qux.new qux
720 $ mv qux.new qux
670 $ hg ci -m 'qux:4->4+'
721 $ hg ci -m 'qux:4->4+'
671 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
722 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
672 16: baz:0
723 16: baz:0
673 19: baz:3
724 19: baz:3
674 20: baz:4
725 20: baz:4
675 24: baz:3->3+
726 24: baz:3->3+
676 25: qux:4->4+
727 25: qux:4->4+
677
728
678 but are missed when following children
729 but are missed when following children
679 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
730 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
680 24: baz:3->3+
731 24: baz:3->3+
681
732
682 merge
733 merge
683 $ hg up 24 --quiet
734 $ hg up 24 --quiet
684 $ echo 7 >> baz
735 $ echo 7 >> baz
685 $ hg ci -m 'one more line, out of line range'
736 $ hg ci -m 'one more line, out of line range'
686 created new head
737 created new head
687 $ sed 's/3+/3-/' baz > baz.new
738 $ sed 's/3+/3-/' baz > baz.new
688 $ mv baz.new baz
739 $ mv baz.new baz
689 $ hg ci -m 'baz:3+->3-'
740 $ hg ci -m 'baz:3+->3-'
690 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
741 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
691 16: baz:0
742 16: baz:0
692 19: baz:3
743 19: baz:3
693 20: baz:4
744 20: baz:4
694 24: baz:3->3+
745 24: baz:3->3+
695 27: baz:3+->3-
746 27: baz:3+->3-
696 $ hg merge 25
747 $ hg merge 25
697 merging baz and qux to qux
748 merging baz and qux to qux
698 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
749 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
699 (branch merge, don't forget to commit)
750 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
751 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
752 [1]
753 $ cat qux
754 0
755 0
756 1 baz:1
757 2 baz:2
758 <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
759 3- baz:3
760 4 baz:4
761 ||||||| base
762 3+ baz:3
763 4 baz:4
764 =======
765 3+ baz:3
766 4+ baz:4
767 >>>>>>> merge rev: cb8df70ae185 - test: qux:4->4+
768 5
769 6
770 7
771 $ cat > qux <<EOF
772 > 0
773 > 0
774 > 1 baz:1
775 > 2 baz:2
776 > 3- baz:3
777 > 4 baz:4
778 > 5
779 > 6
780 > 7
781 > EOF
782 $ hg resolve --mark -q
783 $ rm qux.orig
700 $ hg ci -m merge
784 $ hg ci -m merge
701 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
785 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
702 16: baz:0
786 16: baz:0
703 19: baz:3
787 19: baz:3
704 20: baz:4
788 20: baz:4
705 24: baz:3->3+
789 24: baz:3->3+
706 25: qux:4->4+
790 25: qux:4->4+
707 27: baz:3+->3-
791 27: baz:3+->3-
708 28: merge
792 28: merge
709 $ hg up 25 --quiet
793 $ hg up 25 --quiet
710 $ hg merge 27
794 $ hg merge 27
711 merging qux and baz to qux
795 merging qux and baz to qux
712 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
796 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
713 (branch merge, don't forget to commit)
797 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
798 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
799 [1]
800 $ cat qux
801 0
802 0
803 1 baz:1
804 2 baz:2
805 <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
806 3+ baz:3
807 4+ baz:4
808 ||||||| base
809 3+ baz:3
810 4 baz:4
811 =======
812 3- baz:3
813 4 baz:4
814 >>>>>>> merge rev: 863de62655ef - test: baz:3+->3-
815 5
816 6
817 7
818 $ cat > qux <<EOF
819 > 0
820 > 0
821 > 1 baz:1
822 > 2 baz:2
823 > 3+ baz:3
824 > 4+ baz:4
825 > 5
826 > 6
827 > EOF
828 $ hg resolve --mark -q
829 $ rm qux.orig
714 $ hg ci -m 'merge from other side'
830 $ hg ci -m 'merge from other side'
715 created new head
831 created new head
716 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
832 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
717 16: baz:0
833 16: baz:0
718 19: baz:3
834 19: baz:3
719 20: baz:4
835 20: baz:4
720 24: baz:3->3+
836 24: baz:3->3+
721 25: qux:4->4+
837 25: qux:4->4+
722 27: baz:3+->3-
838 27: baz:3+->3-
723 29: merge from other side
839 29: merge from other side
724 $ hg up 24 --quiet
840 $ hg up 24 --quiet
725
841
726 we are missing the branch with rename when following children
842 we are missing the branch with rename when following children
727 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
843 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
728 27: baz:3+->3-
844 27: baz:3+->3-
729
845
730 we follow all branches in descending direction
846 we follow all branches in descending direction
731 $ hg up 23 --quiet
847 $ hg up 23 --quiet
732 $ sed 's/3/+3/' baz > baz.new
848 $ sed 's/3/+3/' baz > baz.new
733 $ mv baz.new baz
849 $ mv baz.new baz
734 $ hg ci -m 'baz:3->+3'
850 $ hg ci -m 'baz:3->+3'
735 created new head
851 created new head
736 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
852 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
737 @ 30: baz:3->+3
853 @ 30: baz:3->+3
738 :
854 :
739 : o 27: baz:3+->3-
855 : o 27: baz:3+->3-
740 : :
856 : :
741 : o 24: baz:3->3+
857 : o 24: baz:3->3+
742 :/
858 :/
743 o 20: baz:4
859 o 20: baz:4
744 |\
860 |\
745 | o 19: baz:3
861 | o 19: baz:3
746 |/
862 |/
747 o 18: baz:2
863 o 18: baz:2
748 :
864 :
749 o 16: baz:0
865 o 16: baz:0
750 |
866 |
751 ~
867 ~
752
868
753 Issue5595: on a merge changeset with different line ranges depending on
869 Issue5595: on a merge changeset with different line ranges depending on
754 parent, be conservative and use the surrounding interval to avoid loosing
870 parent, be conservative and use the surrounding interval to avoid loosing
755 track of possible further descendants in specified range.
871 track of possible further descendants in specified range.
756
872
757 $ hg up 23 --quiet
873 $ hg up 23 --quiet
758 $ hg cat baz -r 24
874 $ hg cat baz -r 24
759 0
875 0
760 0
876 0
761 1 baz:1
877 1 baz:1
762 2 baz:2
878 2 baz:2
763 3+ baz:3
879 3+ baz:3
764 4 baz:4
880 4 baz:4
765 5
881 5
766 6
882 6
767 $ cat > baz << EOF
883 $ cat > baz << EOF
768 > 0
884 > 0
769 > 0
885 > 0
770 > a
886 > a
771 > b
887 > b
772 > 3+ baz:3
888 > 3+ baz:3
773 > 4 baz:4
889 > 4 baz:4
774 > y
890 > y
775 > z
891 > z
776 > EOF
892 > EOF
777 $ hg ci -m 'baz: mostly rewrite with some content from 24'
893 $ hg ci -m 'baz: mostly rewrite with some content from 24'
778 created new head
894 created new head
779 $ hg merge --tool :merge-other 24
895 $ hg merge --tool :merge-other 24
780 merging baz
896 merging baz
781 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
897 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
782 (branch merge, don't forget to commit)
898 (branch merge, don't forget to commit)
783 $ hg ci -m 'merge forgetting about baz rewrite'
899 $ hg ci -m 'merge forgetting about baz rewrite'
784 $ cat > baz << EOF
900 $ cat > baz << EOF
785 > 0
901 > 0
786 > 0
902 > 0
787 > 1 baz:1
903 > 1 baz:1
788 > 2+ baz:2
904 > 2+ baz:2
789 > 3+ baz:3
905 > 3+ baz:3
790 > 4 baz:4
906 > 4 baz:4
791 > 5
907 > 5
792 > 6
908 > 6
793 > EOF
909 > EOF
794 $ hg ci -m 'baz: narrow change (2->2+)'
910 $ hg ci -m 'baz: narrow change (2->2+)'
795 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
911 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
796 @ 33: baz: narrow change (2->2+)
912 @ 33: baz: narrow change (2->2+)
797 |
913 |
798 o 32: merge forgetting about baz rewrite
914 o 32: merge forgetting about baz rewrite
799 |\
915 |\
800 | o 31: baz: mostly rewrite with some content from 24
916 | o 31: baz: mostly rewrite with some content from 24
801 | :
917 | :
802 | : o 30: baz:3->+3
918 | : o 30: baz:3->+3
803 | :/
919 | :/
804 +---o 27: baz:3+->3-
920 +---o 27: baz:3+->3-
805 | :
921 | :
806 o : 24: baz:3->3+
922 o : 24: baz:3->3+
807 :/
923 :/
808 o 20: baz:4
924 o 20: baz:4
809 |\
925 |\
810 ~ ~
926 ~ ~
811
927
812 An integer as a line range, which is parsed as '1:1'
928 An integer as a line range, which is parsed as '1:1'
813
929
814 $ hg log -r 'followlines(baz, 1)'
930 $ hg log -r 'followlines(baz, 1)'
815 changeset: 22:2174d0bf352a
931 changeset: 22:2174d0bf352a
816 user: test
932 user: test
817 date: Thu Jan 01 00:00:00 1970 +0000
933 date: Thu Jan 01 00:00:00 1970 +0000
818 summary: added two lines with 0
934 summary: added two lines with 0
819
935
820
936
821 check error cases
937 check error cases
822 $ hg up 24 --quiet
938 $ hg up 24 --quiet
823 $ hg log -r 'followlines()'
939 $ hg log -r 'followlines()'
824 hg: parse error: followlines takes at least 1 positional arguments
940 hg: parse error: followlines takes at least 1 positional arguments
825 [255]
941 [255]
826 $ hg log -r 'followlines(baz)'
942 $ hg log -r 'followlines(baz)'
827 hg: parse error: followlines requires a line range
943 hg: parse error: followlines requires a line range
828 [255]
944 [255]
829 $ hg log -r 'followlines(baz, x)'
945 $ hg log -r 'followlines(baz, x)'
830 hg: parse error: followlines expects a line number or a range
946 hg: parse error: followlines expects a line number or a range
831 [255]
947 [255]
832 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
948 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
833 hg: parse error: followlines expects exactly one revision
949 hg: parse error: followlines expects exactly one revision
834 [255]
950 [255]
835 $ hg log -r 'followlines("glob:*", 1:2)'
951 $ hg log -r 'followlines("glob:*", 1:2)'
836 hg: parse error: followlines expects exactly one file
952 hg: parse error: followlines expects exactly one file
837 [255]
953 [255]
838 $ hg log -r 'followlines(baz, 1:)'
954 $ hg log -r 'followlines(baz, 1:)'
839 hg: parse error: line range bounds must be integers
955 hg: parse error: line range bounds must be integers
840 [255]
956 [255]
841 $ hg log -r 'followlines(baz, :1)'
957 $ hg log -r 'followlines(baz, :1)'
842 hg: parse error: line range bounds must be integers
958 hg: parse error: line range bounds must be integers
843 [255]
959 [255]
844 $ hg log -r 'followlines(baz, x:4)'
960 $ hg log -r 'followlines(baz, x:4)'
845 hg: parse error: line range bounds must be integers
961 hg: parse error: line range bounds must be integers
846 [255]
962 [255]
847 $ hg log -r 'followlines(baz, 5:4)'
963 $ hg log -r 'followlines(baz, 5:4)'
848 hg: parse error: line range must be positive
964 hg: parse error: line range must be positive
849 [255]
965 [255]
850 $ hg log -r 'followlines(baz, 0:4)'
966 $ hg log -r 'followlines(baz, 0:4)'
851 hg: parse error: fromline must be strictly positive
967 hg: parse error: fromline must be strictly positive
852 [255]
968 [255]
853 $ hg log -r 'followlines(baz, 2:40)'
969 $ hg log -r 'followlines(baz, 2:40)'
854 abort: line range exceeds file size
970 abort: line range exceeds file size
855 [255]
971 [255]
856 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
972 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
857 hg: parse error at 43: not a prefix: [
973 hg: parse error at 43: not a prefix: [
858 (followlines(baz, 2:4, startrev=20, descend=[1])
974 (followlines(baz, 2:4, startrev=20, descend=[1])
859 ^ here)
975 ^ here)
860 [255]
976 [255]
861 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
977 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
862 hg: parse error: descend argument must be a boolean
978 hg: parse error: descend argument must be a boolean
863 [255]
979 [255]
864
980
865 Test empty annotate output
981 Test empty annotate output
866
982
867 $ printf '\0' > binary
983 $ printf '\0' > binary
868 $ touch empty
984 $ touch empty
869 $ hg ci -qAm 'add binary and empty files'
985 $ hg ci -qAm 'add binary and empty files'
870
986
871 $ hg annotate binary empty
987 $ hg annotate binary empty
872 binary: binary file
988 binary: binary file
873
989
874 $ hg annotate -Tjson binary empty
990 $ hg annotate -Tjson binary empty
875 [
991 [
876 {
992 {
877 "path": "binary"
993 "path": "binary"
878 },
994 },
879 {
995 {
880 "lines": [],
996 "lines": [],
881 "path": "empty"
997 "path": "empty"
882 }
998 }
883 ]
999 ]
884
1000
885 Test annotate with whitespace options
1001 Test annotate with whitespace options
886
1002
887 $ cd ..
1003 $ cd ..
888 $ hg init repo-ws
1004 $ hg init repo-ws
889 $ cd repo-ws
1005 $ cd repo-ws
890 $ cat > a <<EOF
1006 $ cat > a <<EOF
891 > aa
1007 > aa
892 >
1008 >
893 > b b
1009 > b b
894 > EOF
1010 > EOF
895 $ hg ci -Am "adda"
1011 $ hg ci -Am "adda"
896 adding a
1012 adding a
897 $ sed 's/EOL$//g' > a <<EOF
1013 $ sed 's/EOL$//g' > a <<EOF
898 > a a
1014 > a a
899 >
1015 >
900 > EOL
1016 > EOL
901 > b b
1017 > b b
902 > EOF
1018 > EOF
903 $ hg ci -m "changea"
1019 $ hg ci -m "changea"
904
1020
905 Annotate with no option
1021 Annotate with no option
906
1022
907 $ hg annotate a
1023 $ hg annotate a
908 1: a a
1024 1: a a
909 0:
1025 0:
910 1:
1026 1:
911 1: b b
1027 1: b b
912
1028
913 Annotate with --ignore-space-change
1029 Annotate with --ignore-space-change
914
1030
915 $ hg annotate --ignore-space-change a
1031 $ hg annotate --ignore-space-change a
916 1: a a
1032 1: a a
917 1:
1033 1:
918 0:
1034 0:
919 0: b b
1035 0: b b
920
1036
921 Annotate with --ignore-all-space
1037 Annotate with --ignore-all-space
922
1038
923 $ hg annotate --ignore-all-space a
1039 $ hg annotate --ignore-all-space a
924 0: a a
1040 0: a a
925 0:
1041 0:
926 1:
1042 1:
927 0: b b
1043 0: b b
928
1044
929 Annotate with --ignore-blank-lines (similar to no options case)
1045 Annotate with --ignore-blank-lines (similar to no options case)
930
1046
931 $ hg annotate --ignore-blank-lines a
1047 $ hg annotate --ignore-blank-lines a
932 1: a a
1048 1: a a
933 0:
1049 0:
934 1:
1050 1:
935 1: b b
1051 1: b b
936
1052
937 $ cd ..
1053 $ cd ..
938
1054
939 Annotate with orphaned CR (issue5798)
1055 Annotate with orphaned CR (issue5798)
940 -------------------------------------
1056 -------------------------------------
941
1057
942 $ hg init repo-cr
1058 $ hg init repo-cr
943 $ cd repo-cr
1059 $ cd repo-cr
944
1060
945 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
1061 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
946 > import sys
1062 > import sys
947 > from mercurial.utils import procutil
1063 > from mercurial.utils import procutil
948 > procutil.setbinary(sys.stdin)
1064 > procutil.setbinary(sys.stdin)
949 > procutil.setbinary(sys.stdout)
1065 > procutil.setbinary(sys.stdout)
950 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
1066 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
951 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
1067 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
952 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
1068 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
953 > EOF
1069 > EOF
954
1070
955 >>> with open('a', 'wb') as f:
1071 >>> with open('a', 'wb') as f:
956 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
1072 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
957 $ hg ci -qAm0
1073 $ hg ci -qAm0
958 >>> with open('a', 'wb') as f:
1074 >>> with open('a', 'wb') as f:
959 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
1075 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
960 $ hg ci -m1
1076 $ hg ci -m1
961
1077
962 $ hg annotate -r0 a | "$PYTHON" "$TESTTMP/substcr.py"
1078 $ hg annotate -r0 a | "$PYTHON" "$TESTTMP/substcr.py"
963 0: 0a[CR]0b[CR]
1079 0: 0a[CR]0b[CR]
964 0: 0c[CR]0d[CR]
1080 0: 0c[CR]0d[CR]
965 0: 0e
1081 0: 0e
966 0: 0f
1082 0: 0f
967 0: 0g
1083 0: 0g
968 $ hg annotate -r1 a | "$PYTHON" "$TESTTMP/substcr.py"
1084 $ hg annotate -r1 a | "$PYTHON" "$TESTTMP/substcr.py"
969 0: 0a[CR]0b[CR]
1085 0: 0a[CR]0b[CR]
970 1: 1c[CR]1d[CR]
1086 1: 1c[CR]1d[CR]
971 0: 0e
1087 0: 0e
972 1: 1f
1088 1: 1f
973 0: 0g
1089 0: 0g
974
1090
975 $ cd ..
1091 $ cd ..
976
1092
977 Annotate with linkrev pointing to another branch
1093 Annotate with linkrev pointing to another branch
978 ------------------------------------------------
1094 ------------------------------------------------
979
1095
980 create history with a filerev whose linkrev points to another branch
1096 create history with a filerev whose linkrev points to another branch
981
1097
982 $ hg init branchedlinkrev
1098 $ hg init branchedlinkrev
983 $ cd branchedlinkrev
1099 $ cd branchedlinkrev
984 $ echo A > a
1100 $ echo A > a
985 $ hg commit -Am 'contentA'
1101 $ hg commit -Am 'contentA'
986 adding a
1102 adding a
987 $ echo B >> a
1103 $ echo B >> a
988 $ hg commit -m 'contentB'
1104 $ hg commit -m 'contentB'
989 $ hg up --rev 'desc(contentA)'
1105 $ hg up --rev 'desc(contentA)'
990 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
991 $ echo unrelated > unrelated
1107 $ echo unrelated > unrelated
992 $ hg commit -Am 'unrelated'
1108 $ hg commit -Am 'unrelated'
993 adding unrelated
1109 adding unrelated
994 created new head
1110 created new head
995 $ hg graft -r 'desc(contentB)'
1111 $ hg graft -r 'desc(contentB)'
996 grafting 1:fd27c222e3e6 "contentB"
1112 grafting 1:fd27c222e3e6 "contentB"
997 $ echo C >> a
1113 $ echo C >> a
998 $ hg commit -m 'contentC'
1114 $ hg commit -m 'contentC'
999 $ echo W >> a
1115 $ echo W >> a
1000 $ hg log -G
1116 $ hg log -G
1001 @ changeset: 4:072f1e8df249
1117 @ changeset: 4:072f1e8df249
1002 | tag: tip
1118 | tag: tip
1003 | user: test
1119 | user: test
1004 | date: Thu Jan 01 00:00:00 1970 +0000
1120 | date: Thu Jan 01 00:00:00 1970 +0000
1005 | summary: contentC
1121 | summary: contentC
1006 |
1122 |
1007 o changeset: 3:ff38df03cc4b
1123 o changeset: 3:ff38df03cc4b
1008 | user: test
1124 | user: test
1009 | date: Thu Jan 01 00:00:00 1970 +0000
1125 | date: Thu Jan 01 00:00:00 1970 +0000
1010 | summary: contentB
1126 | summary: contentB
1011 |
1127 |
1012 o changeset: 2:62aaf3f6fc06
1128 o changeset: 2:62aaf3f6fc06
1013 | parent: 0:f0932f74827e
1129 | parent: 0:f0932f74827e
1014 | user: test
1130 | user: test
1015 | date: Thu Jan 01 00:00:00 1970 +0000
1131 | date: Thu Jan 01 00:00:00 1970 +0000
1016 | summary: unrelated
1132 | summary: unrelated
1017 |
1133 |
1018 | o changeset: 1:fd27c222e3e6
1134 | o changeset: 1:fd27c222e3e6
1019 |/ user: test
1135 |/ user: test
1020 | date: Thu Jan 01 00:00:00 1970 +0000
1136 | date: Thu Jan 01 00:00:00 1970 +0000
1021 | summary: contentB
1137 | summary: contentB
1022 |
1138 |
1023 o changeset: 0:f0932f74827e
1139 o changeset: 0:f0932f74827e
1024 user: test
1140 user: test
1025 date: Thu Jan 01 00:00:00 1970 +0000
1141 date: Thu Jan 01 00:00:00 1970 +0000
1026 summary: contentA
1142 summary: contentA
1027
1143
1028
1144
1029 Annotate should list ancestor of starting revision only
1145 Annotate should list ancestor of starting revision only
1030
1146
1031 $ hg annotate a
1147 $ hg annotate a
1032 0: A
1148 0: A
1033 3: B
1149 3: B
1034 4: C
1150 4: C
1035
1151
1036 $ hg annotate a -r 'wdir()'
1152 $ hg annotate a -r 'wdir()'
1037 0 : A
1153 0 : A
1038 3 : B
1154 3 : B
1039 4 : C
1155 4 : C
1040 4+: W
1156 4+: W
1041
1157
1042 Even when the starting revision is the linkrev-shadowed one:
1158 Even when the starting revision is the linkrev-shadowed one:
1043
1159
1044 $ hg annotate a -r 3
1160 $ hg annotate a -r 3
1045 0: A
1161 0: A
1046 3: B
1162 3: B
1047
1163
1048 $ cd ..
1164 $ cd ..
1049
1165
1050 Issue5360: Deleted chunk in p1 of a merge changeset
1166 Issue5360: Deleted chunk in p1 of a merge changeset
1051
1167
1052 $ hg init repo-5360
1168 $ hg init repo-5360
1053 $ cd repo-5360
1169 $ cd repo-5360
1054 $ echo 1 > a
1170 $ echo 1 > a
1055 $ hg commit -A a -m 1
1171 $ hg commit -A a -m 1
1056 $ echo 2 >> a
1172 $ echo 2 >> a
1057 $ hg commit -m 2
1173 $ hg commit -m 2
1058 $ echo a > a
1174 $ echo a > a
1059 $ hg commit -m a
1175 $ hg commit -m a
1060 $ hg update '.^' -q
1176 $ hg update '.^' -q
1061 $ echo 3 >> a
1177 $ echo 3 >> a
1062 $ hg commit -m 3 -q
1178 $ hg commit -m 3 -q
1063 $ hg merge 2 -q
1179 $ hg merge 2 -q
1180 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1181 [1]
1182 $ cat a
1183 <<<<<<< working copy: 0a068f0261cf - test: 3
1184 1
1185 2
1186 3
1187 ||||||| base
1188 1
1189 2
1190 =======
1191 a
1192 >>>>>>> merge rev: 9409851bc20a - test: a
1064 $ cat > a << EOF
1193 $ cat > a << EOF
1065 > b
1194 > b
1066 > 1
1195 > 1
1067 > 2
1196 > 2
1068 > 3
1197 > 3
1069 > a
1198 > a
1070 > EOF
1199 > EOF
1071 $ hg resolve --mark -q
1200 $ hg resolve --mark -q
1201 $ rm a.orig
1072 $ hg commit -m m
1202 $ hg commit -m m
1073 $ hg annotate a
1203 $ hg annotate a
1074 4: b
1204 4: b
1075 0: 1
1205 0: 1
1076 1: 2
1206 1: 2
1077 3: 3
1207 3: 3
1078 2: a
1208 2: a
1079
1209
1080 $ cd ..
1210 $ cd ..
@@ -1,764 +1,826 b''
1 (this file is backported from core hg tests/test-annotate.t)
1 (this file is backported from core hg tests/test-annotate.t)
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [ui]
5 > merge = :merge3
4 > [diff]
6 > [diff]
5 > git=1
7 > git=1
6 > [extensions]
8 > [extensions]
7 > fastannotate=
9 > fastannotate=
8 > [fastannotate]
10 > [fastannotate]
9 > modes=fctx
11 > modes=fctx
10 > forcefollow=False
12 > forcefollow=False
11 > mainbranch=.
13 > mainbranch=.
12 > EOF
14 > EOF
13
15
14 $ HGMERGE=true; export HGMERGE
15
16 init
16 init
17
17
18 $ hg init repo
18 $ hg init repo
19 $ cd repo
19 $ cd repo
20
20
21 commit
21 commit
22
22
23 $ echo 'a' > a
23 $ echo 'a' > a
24 $ hg ci -A -m test -u nobody -d '1 0'
24 $ hg ci -A -m test -u nobody -d '1 0'
25 adding a
25 adding a
26
26
27 annotate -c
27 annotate -c
28
28
29 $ hg annotate -c a
29 $ hg annotate -c a
30 8435f90966e4: a
30 8435f90966e4: a
31
31
32 annotate -cl
32 annotate -cl
33
33
34 $ hg annotate -cl a
34 $ hg annotate -cl a
35 8435f90966e4:1: a
35 8435f90966e4:1: a
36
36
37 annotate -d
37 annotate -d
38
38
39 $ hg annotate -d a
39 $ hg annotate -d a
40 Thu Jan 01 00:00:01 1970 +0000: a
40 Thu Jan 01 00:00:01 1970 +0000: a
41
41
42 annotate -n
42 annotate -n
43
43
44 $ hg annotate -n a
44 $ hg annotate -n a
45 0: a
45 0: a
46
46
47 annotate -nl
47 annotate -nl
48
48
49 $ hg annotate -nl a
49 $ hg annotate -nl a
50 0:1: a
50 0:1: a
51
51
52 annotate -u
52 annotate -u
53
53
54 $ hg annotate -u a
54 $ hg annotate -u a
55 nobody: a
55 nobody: a
56
56
57 annotate -cdnu
57 annotate -cdnu
58
58
59 $ hg annotate -cdnu a
59 $ hg annotate -cdnu a
60 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
60 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
61
61
62 annotate -cdnul
62 annotate -cdnul
63
63
64 $ hg annotate -cdnul a
64 $ hg annotate -cdnul a
65 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
65 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
66
66
67 annotate (JSON)
67 annotate (JSON)
68
68
69 $ hg annotate -Tjson a
69 $ hg annotate -Tjson a
70 [
70 [
71 {
71 {
72 "lines": [{"line": "a\n", "rev": 0}],
72 "lines": [{"line": "a\n", "rev": 0}],
73 "path": "a"
73 "path": "a"
74 }
74 }
75 ]
75 ]
76
76
77 $ hg annotate -Tjson -cdfnul a
77 $ hg annotate -Tjson -cdfnul a
78 [
78 [
79 {
79 {
80 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
80 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
81 "path": "a"
81 "path": "a"
82 }
82 }
83 ]
83 ]
84
84
85 $ cat <<EOF >>a
85 $ cat <<EOF >>a
86 > a
86 > a
87 > a
87 > a
88 > EOF
88 > EOF
89 $ hg ci -ma1 -d '1 0'
89 $ hg ci -ma1 -d '1 0'
90 $ hg cp a b
90 $ hg cp a b
91 $ hg ci -mb -d '1 0'
91 $ hg ci -mb -d '1 0'
92 $ cat <<EOF >> b
92 $ cat <<EOF >> b
93 > b4
93 > b4
94 > b5
94 > b5
95 > b6
95 > b6
96 > EOF
96 > EOF
97 $ hg ci -mb2 -d '2 0'
97 $ hg ci -mb2 -d '2 0'
98
98
99 annotate -n b
99 annotate -n b
100
100
101 $ hg annotate -n b
101 $ hg annotate -n b
102 0: a
102 0: a
103 1: a
103 1: a
104 1: a
104 1: a
105 3: b4
105 3: b4
106 3: b5
106 3: b5
107 3: b6
107 3: b6
108
108
109 annotate --no-follow b
109 annotate --no-follow b
110
110
111 $ hg annotate --no-follow b
111 $ hg annotate --no-follow b
112 2: a
112 2: a
113 2: a
113 2: a
114 2: a
114 2: a
115 3: b4
115 3: b4
116 3: b5
116 3: b5
117 3: b6
117 3: b6
118
118
119 annotate -nl b
119 annotate -nl b
120
120
121 $ hg annotate -nl b
121 $ hg annotate -nl b
122 0:1: a
122 0:1: a
123 1:2: a
123 1:2: a
124 1:3: a
124 1:3: a
125 3:4: b4
125 3:4: b4
126 3:5: b5
126 3:5: b5
127 3:6: b6
127 3:6: b6
128
128
129 annotate -nf b
129 annotate -nf b
130
130
131 $ hg annotate -nf b
131 $ hg annotate -nf b
132 0 a: a
132 0 a: a
133 1 a: a
133 1 a: a
134 1 a: a
134 1 a: a
135 3 b: b4
135 3 b: b4
136 3 b: b5
136 3 b: b5
137 3 b: b6
137 3 b: b6
138
138
139 annotate -nlf b
139 annotate -nlf b
140
140
141 $ hg annotate -nlf b
141 $ hg annotate -nlf b
142 0 a:1: a
142 0 a:1: a
143 1 a:2: a
143 1 a:2: a
144 1 a:3: a
144 1 a:3: a
145 3 b:4: b4
145 3 b:4: b4
146 3 b:5: b5
146 3 b:5: b5
147 3 b:6: b6
147 3 b:6: b6
148
148
149 $ hg up -C 2
149 $ hg up -C 2
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 $ cat <<EOF >> b
151 $ cat <<EOF >> b
152 > b4
152 > b4
153 > c
153 > c
154 > b5
154 > b5
155 > EOF
155 > EOF
156 $ hg ci -mb2.1 -d '2 0'
156 $ hg ci -mb2.1 -d '2 0'
157 created new head
157 created new head
158 $ hg merge
158 $ hg merge
159 merging b
159 merging b
160 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
160 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
161 (branch merge, don't forget to commit)
161 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
162 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
163 [1]
164 $ cat b
165 a
166 a
167 a
168 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
169 b4
170 c
171 b5
172 ||||||| base
173 =======
174 b4
175 b5
176 b6
177 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
178 $ cat <<EOF > b
179 > a
180 > a
181 > a
182 > b4
183 > c
184 > b5
185 > EOF
186 $ hg resolve --mark -q
187 $ rm b.orig
162 $ hg ci -mmergeb -d '3 0'
188 $ hg ci -mmergeb -d '3 0'
163
189
164 annotate after merge
190 annotate after merge
165 (note: the first one falls back to the vanilla annotate which does not use linelog)
191 (note: the first one falls back to the vanilla annotate which does not use linelog)
166
192
167 $ hg annotate -nf b --debug
193 $ hg annotate -nf b --debug
168 fastannotate: b: rebuilding broken cache
194 fastannotate: b: rebuilding broken cache
169 fastannotate: b: 5 new changesets in the main branch
195 fastannotate: b: 5 new changesets in the main branch
170 0 a: a
196 0 a: a
171 1 a: a
197 1 a: a
172 1 a: a
198 1 a: a
173 3 b: b4
199 3 b: b4
174 4 b: c
200 4 b: c
175 3 b: b5
201 3 b: b5
176
202
177 (difference explained below)
203 (difference explained below)
178
204
179 $ hg annotate -nf b --debug
205 $ hg annotate -nf b --debug
180 fastannotate: b: using fast path (resolved fctx: False)
206 fastannotate: b: using fast path (resolved fctx: False)
181 0 a: a
207 0 a: a
182 1 a: a
208 1 a: a
183 1 a: a
209 1 a: a
184 4 b: b4
210 4 b: b4
185 4 b: c
211 4 b: c
186 4 b: b5
212 4 b: b5
187
213
188 annotate after merge with -l
214 annotate after merge with -l
189 (fastannotate differs from annotate)
215 (fastannotate differs from annotate)
190
216
191 $ hg log -Gp -T '{rev}:{node}' -r '2..5'
217 $ hg log -Gp -T '{rev}:{node}' -r '2..5'
192 @ 5:64afcdf8e29e063c635be123d8d2fb160af00f7e
218 @ 5:64afcdf8e29e063c635be123d8d2fb160af00f7e
193 |\
219 |\
194 | o 4:5fbdc1152d97597717021ad9e063061b200f146bdiff --git a/b b/b
220 | o 4:5fbdc1152d97597717021ad9e063061b200f146bdiff --git a/b b/b
195 | | --- a/b
221 | | --- a/b
196 | | +++ b/b
222 | | +++ b/b
197 | | @@ -1,3 +1,6 @@
223 | | @@ -1,3 +1,6 @@
198 | | a
224 | | a
199 | | a
225 | | a
200 | | a
226 | | a
201 | | +b4
227 | | +b4
202 | | +c
228 | | +c
203 | | +b5
229 | | +b5
204 | |
230 | |
205 o | 3:37ec9f5c3d1f99572d7075971cb4876e2139b52fdiff --git a/b b/b
231 o | 3:37ec9f5c3d1f99572d7075971cb4876e2139b52fdiff --git a/b b/b
206 |/ --- a/b
232 |/ --- a/b
207 | +++ b/b
233 | +++ b/b
208 | @@ -1,3 +1,6 @@
234 | @@ -1,3 +1,6 @@
209 | a
235 | a
210 | a
236 | a
211 | a
237 | a
212 | +b4
238 | +b4
213 | +b5
239 | +b5
214 | +b6
240 | +b6
215 |
241 |
216 o 2:3086dbafde1ce745abfc8d2d367847280aabae9ddiff --git a/a b/b
242 o 2:3086dbafde1ce745abfc8d2d367847280aabae9ddiff --git a/a b/b
217 | copy from a
243 | copy from a
218 ~ copy to b
244 ~ copy to b
219
245
220
246
221 (in this case, "b4", "b5" could be considered introduced by either rev 3, or rev 4.
247 (in this case, "b4", "b5" could be considered introduced by either rev 3, or rev 4.
222 and that causes the rev number difference)
248 and that causes the rev number difference)
223
249
224 $ hg annotate -nlf b --config fastannotate.modes=
250 $ hg annotate -nlf b --config fastannotate.modes=
225 0 a:1: a
251 0 a:1: a
226 1 a:2: a
252 1 a:2: a
227 1 a:3: a
253 1 a:3: a
228 3 b:4: b4
254 3 b:4: b4
229 4 b:5: c
255 4 b:5: c
230 3 b:5: b5
256 3 b:5: b5
231
257
232 $ hg annotate -nlf b
258 $ hg annotate -nlf b
233 0 a:1: a
259 0 a:1: a
234 1 a:2: a
260 1 a:2: a
235 1 a:3: a
261 1 a:3: a
236 4 b:4: b4
262 4 b:4: b4
237 4 b:5: c
263 4 b:5: c
238 4 b:6: b5
264 4 b:6: b5
239
265
240 $ hg up -C 1
266 $ hg up -C 1
241 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
242 $ hg cp a b
268 $ hg cp a b
243 $ cat <<EOF > b
269 $ cat <<EOF > b
244 > a
270 > a
245 > z
271 > z
246 > a
272 > a
247 > EOF
273 > EOF
248 $ hg ci -mc -d '3 0'
274 $ hg ci -mc -d '3 0'
249 created new head
275 created new head
276 BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
250 $ hg merge
277 $ hg merge
251 merging b
278 merging b
252 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
279 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
253 (branch merge, don't forget to commit)
280 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
254 $ cat <<EOF >> b
281 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
282 [1]
283 $ cat b
284 <<<<<<< working copy: b80e3e32f75a - test: c
285 a
286 z
287 a
288 ||||||| base
289 =======
290 a
291 a
292 a
293 b4
294 c
295 b5
296 >>>>>>> merge rev: 64afcdf8e29e - test: mergeb
297 $ cat <<EOF > b
298 > a
299 > z
300 > a
255 > b4
301 > b4
256 > c
302 > c
257 > b5
303 > b5
258 > EOF
304 > EOF
305 $ hg resolve --mark -q
306 $ rm b.orig
259 $ echo d >> b
307 $ echo d >> b
260 $ hg ci -mmerge2 -d '4 0'
308 $ hg ci -mmerge2 -d '4 0'
261
309
262 annotate after rename merge
310 annotate after rename merge
263
311
264 $ hg annotate -nf b
312 $ hg annotate -nf b
265 0 a: a
313 0 a: a
266 6 b: z
314 6 b: z
267 1 a: a
315 1 a: a
268 3 b: b4
316 3 b: b4
269 4 b: c
317 4 b: c
270 3 b: b5
318 3 b: b5
271 7 b: d
319 7 b: d
272
320
273 annotate after rename merge with -l
321 annotate after rename merge with -l
274 (fastannotate differs from annotate)
322 (fastannotate differs from annotate)
275
323
276 $ hg log -Gp -T '{rev}:{node}' -r '0+1+6+7'
324 $ hg log -Gp -T '{rev}:{node}' -r '0+1+6+7'
277 @ 7:6284bb6c38fef984a929862a53bbc71ce9eafa81diff --git a/b b/b
325 @ 7:6284bb6c38fef984a929862a53bbc71ce9eafa81diff --git a/b b/b
278 |\ --- a/b
326 |\ --- a/b
279 | : +++ b/b
327 | : +++ b/b
280 | : @@ -1,3 +1,7 @@
328 | : @@ -1,3 +1,7 @@
281 | : a
329 | : a
282 | : z
330 | : z
283 | : a
331 | : a
284 | : +b4
332 | : +b4
285 | : +c
333 | : +c
286 | : +b5
334 | : +b5
287 | : +d
335 | : +d
288 | :
336 | :
289 o : 6:b80e3e32f75a6a67cd4ac85496a11511e9112816diff --git a/a b/b
337 o : 6:b80e3e32f75a6a67cd4ac85496a11511e9112816diff --git a/a b/b
290 :/ copy from a
338 :/ copy from a
291 : copy to b
339 : copy to b
292 : --- a/a
340 : --- a/a
293 : +++ b/b
341 : +++ b/b
294 : @@ -1,3 +1,3 @@
342 : @@ -1,3 +1,3 @@
295 : -a (?)
343 : -a (?)
296 : a
344 : a
297 : +z
345 : +z
298 : a
346 : a
299 : -a (?)
347 : -a (?)
300 :
348 :
301 o 1:762f04898e6684ff713415f7b8a8d53d33f96c92diff --git a/a b/a
349 o 1:762f04898e6684ff713415f7b8a8d53d33f96c92diff --git a/a b/a
302 | --- a/a
350 | --- a/a
303 | +++ b/a
351 | +++ b/a
304 | @@ -1,1 +1,3 @@
352 | @@ -1,1 +1,3 @@
305 | a
353 | a
306 | +a
354 | +a
307 | +a
355 | +a
308 |
356 |
309 o 0:8435f90966e442695d2ded29fdade2bac5ad8065diff --git a/a b/a
357 o 0:8435f90966e442695d2ded29fdade2bac5ad8065diff --git a/a b/a
310 new file mode 100644
358 new file mode 100644
311 --- /dev/null
359 --- /dev/null
312 +++ b/a
360 +++ b/a
313 @@ -0,0 +1,1 @@
361 @@ -0,0 +1,1 @@
314 +a
362 +a
315
363
316
364
317 (note on question marks:
365 (note on question marks:
318 the upstream bdiff change (96f2f50d923f+3633403888ae+8c0c75aa3ff4+5c4e2636c1a9
366 the upstream bdiff change (96f2f50d923f+3633403888ae+8c0c75aa3ff4+5c4e2636c1a9
319 +38ed54888617) alters the output so deletion is not always at the end of the
367 +38ed54888617) alters the output so deletion is not always at the end of the
320 output. for example:
368 output. for example:
321 | a | b | old | new | # old: e1d6aa0e4c3a, new: 8836f13e3c5b
369 | a | b | old | new | # old: e1d6aa0e4c3a, new: 8836f13e3c5b
322 |-------------------|
370 |-------------------|
323 | a | a | a | -a |
371 | a | a | a | -a |
324 | a | z | +z | a |
372 | a | z | +z | a |
325 | a | a | a | +z |
373 | a | a | a | +z |
326 | | | -a | a |
374 | | | -a | a |
327 |-------------------|
375 |-------------------|
328 | a | a | a |
376 | a | a | a |
329 | a | a | a |
377 | a | a | a |
330 | a | | -a |
378 | a | | -a |
331 this leads to more question marks below)
379 this leads to more question marks below)
332
380
333 (rev 1 adds two "a"s and rev 6 deletes one "a".
381 (rev 1 adds two "a"s and rev 6 deletes one "a".
334 the "a" that rev 6 deletes could be either the first or the second "a" of those two "a"s added by rev 1.
382 the "a" that rev 6 deletes could be either the first or the second "a" of those two "a"s added by rev 1.
335 and that causes the line number difference)
383 and that causes the line number difference)
336
384
337 $ hg annotate -nlf b --config fastannotate.modes=
385 $ hg annotate -nlf b --config fastannotate.modes=
338 0 a:1: a
386 0 a:1: a
339 6 b:2: z
387 6 b:2: z
340 1 a:3: a
388 1 a:3: a
341 3 b:4: b4
389 3 b:4: b4
342 4 b:5: c
390 4 b:5: c
343 3 b:5: b5
391 3 b:5: b5
344 7 b:7: d
392 7 b:7: d
345
393
346 $ hg annotate -nlf b
394 $ hg annotate -nlf b
347 0 a:1: a (?)
395 0 a:1: a (?)
348 1 a:2: a (?)
396 1 a:2: a (?)
349 6 b:2: z
397 6 b:2: z
350 1 a:2: a (?)
398 1 a:2: a (?)
351 1 a:3: a (?)
399 1 a:3: a (?)
352 3 b:4: b4
400 3 b:4: b4
353 4 b:5: c
401 4 b:5: c
354 3 b:5: b5
402 3 b:5: b5
355 7 b:7: d
403 7 b:7: d
356
404
357 Issue2807: alignment of line numbers with -l
405 Issue2807: alignment of line numbers with -l
358 (fastannotate differs from annotate, same reason as above)
406 (fastannotate differs from annotate, same reason as above)
359
407
360 $ echo more >> b
408 $ echo more >> b
361 $ hg ci -mmore -d '5 0'
409 $ hg ci -mmore -d '5 0'
362 $ echo more >> b
410 $ echo more >> b
363 $ hg ci -mmore -d '6 0'
411 $ hg ci -mmore -d '6 0'
364 $ echo more >> b
412 $ echo more >> b
365 $ hg ci -mmore -d '7 0'
413 $ hg ci -mmore -d '7 0'
366 $ hg annotate -nlf b
414 $ hg annotate -nlf b
367 0 a: 1: a (?)
415 0 a: 1: a (?)
368 1 a: 2: a (?)
416 1 a: 2: a (?)
369 6 b: 2: z
417 6 b: 2: z
370 1 a: 2: a (?)
418 1 a: 2: a (?)
371 1 a: 3: a (?)
419 1 a: 3: a (?)
372 3 b: 4: b4
420 3 b: 4: b4
373 4 b: 5: c
421 4 b: 5: c
374 3 b: 5: b5
422 3 b: 5: b5
375 7 b: 7: d
423 7 b: 7: d
376 8 b: 8: more
424 8 b: 8: more
377 9 b: 9: more
425 9 b: 9: more
378 10 b:10: more
426 10 b:10: more
379
427
380 linkrev vs rev
428 linkrev vs rev
381
429
382 $ hg annotate -r tip -n a
430 $ hg annotate -r tip -n a
383 0: a
431 0: a
384 1: a
432 1: a
385 1: a
433 1: a
386
434
387 linkrev vs rev with -l
435 linkrev vs rev with -l
388
436
389 $ hg annotate -r tip -nl a
437 $ hg annotate -r tip -nl a
390 0:1: a
438 0:1: a
391 1:2: a
439 1:2: a
392 1:3: a
440 1:3: a
393
441
394 Issue589: "undelete" sequence leads to crash
442 Issue589: "undelete" sequence leads to crash
395
443
396 annotate was crashing when trying to --follow something
444 annotate was crashing when trying to --follow something
397
445
398 like A -> B -> A
446 like A -> B -> A
399
447
400 generate ABA rename configuration
448 generate ABA rename configuration
401
449
402 $ echo foo > foo
450 $ echo foo > foo
403 $ hg add foo
451 $ hg add foo
404 $ hg ci -m addfoo
452 $ hg ci -m addfoo
405 $ hg rename foo bar
453 $ hg rename foo bar
406 $ hg ci -m renamefoo
454 $ hg ci -m renamefoo
407 $ hg rename bar foo
455 $ hg rename bar foo
408 $ hg ci -m renamebar
456 $ hg ci -m renamebar
409
457
410 annotate after ABA with follow
458 annotate after ABA with follow
411
459
412 $ hg annotate --follow foo
460 $ hg annotate --follow foo
413 foo: foo
461 foo: foo
414
462
415 missing file
463 missing file
416
464
417 $ hg ann nosuchfile
465 $ hg ann nosuchfile
418 abort: nosuchfile: no such file in rev e9e6b4fa872f
466 abort: nosuchfile: no such file in rev e9e6b4fa872f
419 [255]
467 [255]
420
468
421 annotate file without '\n' on last line
469 annotate file without '\n' on last line
422
470
423 $ printf "" > c
471 $ printf "" > c
424 $ hg ci -A -m test -u nobody -d '1 0'
472 $ hg ci -A -m test -u nobody -d '1 0'
425 adding c
473 adding c
426 $ hg annotate c
474 $ hg annotate c
427 $ printf "a\nb" > c
475 $ printf "a\nb" > c
428 $ hg ci -m test
476 $ hg ci -m test
429 $ hg annotate c
477 $ hg annotate c
430 [0-9]+: a (re)
478 [0-9]+: a (re)
431 [0-9]+: b (re)
479 [0-9]+: b (re)
432
480
433 Issue3841: check annotation of the file of which filelog includes
481 Issue3841: check annotation of the file of which filelog includes
434 merging between the revision and its ancestor
482 merging between the revision and its ancestor
435
483
436 to reproduce the situation with recent Mercurial, this script uses (1)
484 to reproduce the situation with recent Mercurial, this script uses (1)
437 "hg debugsetparents" to merge without ancestor check by "hg merge",
485 "hg debugsetparents" to merge without ancestor check by "hg merge",
438 and (2) the extension to allow filelog merging between the revision
486 and (2) the extension to allow filelog merging between the revision
439 and its ancestor by overriding "repo._filecommit".
487 and its ancestor by overriding "repo._filecommit".
440
488
441 $ cat > ../legacyrepo.py <<EOF
489 $ cat > ../legacyrepo.py <<EOF
442 > from mercurial import error, node
490 > from mercurial import error, node
443 > def reposetup(ui, repo):
491 > def reposetup(ui, repo):
444 > class legacyrepo(repo.__class__):
492 > class legacyrepo(repo.__class__):
445 > def _filecommit(self, fctx, manifest1, manifest2,
493 > def _filecommit(self, fctx, manifest1, manifest2,
446 > linkrev, tr, changelist, includecopymeta):
494 > linkrev, tr, changelist, includecopymeta):
447 > fname = fctx.path()
495 > fname = fctx.path()
448 > text = fctx.data()
496 > text = fctx.data()
449 > flog = self.file(fname)
497 > flog = self.file(fname)
450 > fparent1 = manifest1.get(fname, node.nullid)
498 > fparent1 = manifest1.get(fname, node.nullid)
451 > fparent2 = manifest2.get(fname, node.nullid)
499 > fparent2 = manifest2.get(fname, node.nullid)
452 > meta = {}
500 > meta = {}
453 > copy = fctx.renamed()
501 > copy = fctx.renamed()
454 > if copy and copy[0] != fname:
502 > if copy and copy[0] != fname:
455 > raise error.Abort('copying is not supported')
503 > raise error.Abort('copying is not supported')
456 > if fparent2 != node.nullid:
504 > if fparent2 != node.nullid:
457 > changelist.append(fname)
505 > changelist.append(fname)
458 > return flog.add(text, meta, tr, linkrev,
506 > return flog.add(text, meta, tr, linkrev,
459 > fparent1, fparent2)
507 > fparent1, fparent2)
460 > raise error.Abort('only merging is supported')
508 > raise error.Abort('only merging is supported')
461 > repo.__class__ = legacyrepo
509 > repo.__class__ = legacyrepo
462 > EOF
510 > EOF
463
511
464 $ cat > baz <<EOF
512 $ cat > baz <<EOF
465 > 1
513 > 1
466 > 2
514 > 2
467 > 3
515 > 3
468 > 4
516 > 4
469 > 5
517 > 5
470 > EOF
518 > EOF
471 $ hg add baz
519 $ hg add baz
472 $ hg commit -m "baz:0"
520 $ hg commit -m "baz:0"
473
521
474 $ cat > baz <<EOF
522 $ cat > baz <<EOF
475 > 1 baz:1
523 > 1 baz:1
476 > 2
524 > 2
477 > 3
525 > 3
478 > 4
526 > 4
479 > 5
527 > 5
480 > EOF
528 > EOF
481 $ hg commit -m "baz:1"
529 $ hg commit -m "baz:1"
482
530
483 $ cat > baz <<EOF
531 $ cat > baz <<EOF
484 > 1 baz:1
532 > 1 baz:1
485 > 2 baz:2
533 > 2 baz:2
486 > 3
534 > 3
487 > 4
535 > 4
488 > 5
536 > 5
489 > EOF
537 > EOF
490 $ hg debugsetparents 17 17
538 $ hg debugsetparents 17 17
491 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
539 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
492 $ hg debugindexdot baz
540 $ hg debugindexdot baz
493 digraph G {
541 digraph G {
494 -1 -> 0
542 -1 -> 0
495 0 -> 1
543 0 -> 1
496 1 -> 2
544 1 -> 2
497 1 -> 2
545 1 -> 2
498 }
546 }
499 $ hg annotate baz
547 $ hg annotate baz
500 17: 1 baz:1
548 17: 1 baz:1
501 18: 2 baz:2
549 18: 2 baz:2
502 16: 3
550 16: 3
503 16: 4
551 16: 4
504 16: 5
552 16: 5
505
553
506 $ cat > baz <<EOF
554 $ cat > baz <<EOF
507 > 1 baz:1
555 > 1 baz:1
508 > 2 baz:2
556 > 2 baz:2
509 > 3 baz:3
557 > 3 baz:3
510 > 4
558 > 4
511 > 5
559 > 5
512 > EOF
560 > EOF
513 $ hg commit -m "baz:3"
561 $ hg commit -m "baz:3"
514
562
515 $ cat > baz <<EOF
563 $ cat > baz <<EOF
516 > 1 baz:1
564 > 1 baz:1
517 > 2 baz:2
565 > 2 baz:2
518 > 3 baz:3
566 > 3 baz:3
519 > 4 baz:4
567 > 4 baz:4
520 > 5
568 > 5
521 > EOF
569 > EOF
522 $ hg debugsetparents 19 18
570 $ hg debugsetparents 19 18
523 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
571 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
524 $ hg debugindexdot baz
572 $ hg debugindexdot baz
525 digraph G {
573 digraph G {
526 -1 -> 0
574 -1 -> 0
527 0 -> 1
575 0 -> 1
528 1 -> 2
576 1 -> 2
529 1 -> 2
577 1 -> 2
530 2 -> 3
578 2 -> 3
531 3 -> 4
579 3 -> 4
532 2 -> 4
580 2 -> 4
533 }
581 }
534 $ hg annotate baz
582 $ hg annotate baz
535 17: 1 baz:1
583 17: 1 baz:1
536 18: 2 baz:2
584 18: 2 baz:2
537 19: 3 baz:3
585 19: 3 baz:3
538 20: 4 baz:4
586 20: 4 baz:4
539 16: 5
587 16: 5
540
588
541 annotate clean file
589 annotate clean file
542
590
543 $ hg annotate -ncr "wdir()" foo
591 $ hg annotate -ncr "wdir()" foo
544 11 472b18db256d : foo
592 11 472b18db256d : foo
545
593
546 annotate modified file
594 annotate modified file
547
595
548 $ echo foofoo >> foo
596 $ echo foofoo >> foo
549 $ hg annotate -r "wdir()" foo
597 $ hg annotate -r "wdir()" foo
550 11 : foo
598 11 : foo
551 20+: foofoo
599 20+: foofoo
552
600
553 $ hg annotate -cr "wdir()" foo
601 $ hg annotate -cr "wdir()" foo
554 472b18db256d : foo
602 472b18db256d : foo
555 b6bedd5477e7+: foofoo
603 b6bedd5477e7+: foofoo
556
604
557 $ hg annotate -ncr "wdir()" foo
605 $ hg annotate -ncr "wdir()" foo
558 11 472b18db256d : foo
606 11 472b18db256d : foo
559 20 b6bedd5477e7+: foofoo
607 20 b6bedd5477e7+: foofoo
560
608
561 $ hg annotate --debug -ncr "wdir()" foo
609 $ hg annotate --debug -ncr "wdir()" foo
562 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
610 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
563 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
611 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
564
612
565 $ hg annotate -udr "wdir()" foo
613 $ hg annotate -udr "wdir()" foo
566 test Thu Jan 01 00:00:00 1970 +0000: foo
614 test Thu Jan 01 00:00:00 1970 +0000: foo
567 test [A-Za-z0-9:+ ]+: foofoo (re)
615 test [A-Za-z0-9:+ ]+: foofoo (re)
568
616
569 $ hg annotate -ncr "wdir()" -Tjson foo
617 $ hg annotate -ncr "wdir()" -Tjson foo
570 [
618 [
571 {
619 {
572 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
620 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
573 "path": "foo"
621 "path": "foo"
574 }
622 }
575 ]
623 ]
576
624
577 annotate added file
625 annotate added file
578
626
579 $ echo bar > bar
627 $ echo bar > bar
580 $ hg add bar
628 $ hg add bar
581 $ hg annotate -ncr "wdir()" bar
629 $ hg annotate -ncr "wdir()" bar
582 20 b6bedd5477e7+: bar
630 20 b6bedd5477e7+: bar
583
631
584 annotate renamed file
632 annotate renamed file
585
633
586 $ hg rename foo renamefoo2
634 $ hg rename foo renamefoo2
587 $ hg annotate -ncr "wdir()" renamefoo2
635 $ hg annotate -ncr "wdir()" renamefoo2
588 11 472b18db256d : foo
636 11 472b18db256d : foo
589 20 b6bedd5477e7+: foofoo
637 20 b6bedd5477e7+: foofoo
590
638
591 annotate missing file
639 annotate missing file
592
640
593 $ rm baz
641 $ rm baz
594 $ hg annotate -ncr "wdir()" baz
642 $ hg annotate -ncr "wdir()" baz
595 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
643 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
596 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
644 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
597 [255]
645 [255]
598
646
599 annotate removed file
647 annotate removed file
600
648
601 $ hg rm baz
649 $ hg rm baz
602 $ hg annotate -ncr "wdir()" baz
650 $ hg annotate -ncr "wdir()" baz
603 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
651 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
604 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
652 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
605 [255]
653 [255]
606
654
607 Test annotate with whitespace options
655 Test annotate with whitespace options
608
656
609 $ cd ..
657 $ cd ..
610 $ hg init repo-ws
658 $ hg init repo-ws
611 $ cd repo-ws
659 $ cd repo-ws
612 $ cat > a <<EOF
660 $ cat > a <<EOF
613 > aa
661 > aa
614 >
662 >
615 > b b
663 > b b
616 > EOF
664 > EOF
617 $ hg ci -Am "adda"
665 $ hg ci -Am "adda"
618 adding a
666 adding a
619 $ sed 's/EOL$//g' > a <<EOF
667 $ sed 's/EOL$//g' > a <<EOF
620 > a a
668 > a a
621 >
669 >
622 > EOL
670 > EOL
623 > b b
671 > b b
624 > EOF
672 > EOF
625 $ hg ci -m "changea"
673 $ hg ci -m "changea"
626
674
627 Annotate with no option
675 Annotate with no option
628
676
629 $ hg annotate a
677 $ hg annotate a
630 1: a a
678 1: a a
631 0:
679 0:
632 1:
680 1:
633 1: b b
681 1: b b
634
682
635 Annotate with --ignore-space-change
683 Annotate with --ignore-space-change
636
684
637 $ hg annotate --ignore-space-change a
685 $ hg annotate --ignore-space-change a
638 1: a a
686 1: a a
639 1:
687 1:
640 0:
688 0:
641 0: b b
689 0: b b
642
690
643 Annotate with --ignore-all-space
691 Annotate with --ignore-all-space
644
692
645 $ hg annotate --ignore-all-space a
693 $ hg annotate --ignore-all-space a
646 0: a a
694 0: a a
647 0:
695 0:
648 1:
696 1:
649 0: b b
697 0: b b
650
698
651 Annotate with --ignore-blank-lines (similar to no options case)
699 Annotate with --ignore-blank-lines (similar to no options case)
652
700
653 $ hg annotate --ignore-blank-lines a
701 $ hg annotate --ignore-blank-lines a
654 1: a a
702 1: a a
655 0:
703 0:
656 1:
704 1:
657 1: b b
705 1: b b
658
706
659 $ cd ..
707 $ cd ..
660
708
661 Annotate with linkrev pointing to another branch
709 Annotate with linkrev pointing to another branch
662 ------------------------------------------------
710 ------------------------------------------------
663
711
664 create history with a filerev whose linkrev points to another branch
712 create history with a filerev whose linkrev points to another branch
665
713
666 $ hg init branchedlinkrev
714 $ hg init branchedlinkrev
667 $ cd branchedlinkrev
715 $ cd branchedlinkrev
668 $ echo A > a
716 $ echo A > a
669 $ hg commit -Am 'contentA'
717 $ hg commit -Am 'contentA'
670 adding a
718 adding a
671 $ echo B >> a
719 $ echo B >> a
672 $ hg commit -m 'contentB'
720 $ hg commit -m 'contentB'
673 $ hg up --rev 'desc(contentA)'
721 $ hg up --rev 'desc(contentA)'
674 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
675 $ echo unrelated > unrelated
723 $ echo unrelated > unrelated
676 $ hg commit -Am 'unrelated'
724 $ hg commit -Am 'unrelated'
677 adding unrelated
725 adding unrelated
678 created new head
726 created new head
679 $ hg graft -r 'desc(contentB)'
727 $ hg graft -r 'desc(contentB)'
680 grafting 1:fd27c222e3e6 "contentB"
728 grafting 1:fd27c222e3e6 "contentB"
681 $ echo C >> a
729 $ echo C >> a
682 $ hg commit -m 'contentC'
730 $ hg commit -m 'contentC'
683 $ echo W >> a
731 $ echo W >> a
684 $ hg log -G
732 $ hg log -G
685 @ changeset: 4:072f1e8df249
733 @ changeset: 4:072f1e8df249
686 | tag: tip
734 | tag: tip
687 | user: test
735 | user: test
688 | date: Thu Jan 01 00:00:00 1970 +0000
736 | date: Thu Jan 01 00:00:00 1970 +0000
689 | summary: contentC
737 | summary: contentC
690 |
738 |
691 o changeset: 3:ff38df03cc4b
739 o changeset: 3:ff38df03cc4b
692 | user: test
740 | user: test
693 | date: Thu Jan 01 00:00:00 1970 +0000
741 | date: Thu Jan 01 00:00:00 1970 +0000
694 | summary: contentB
742 | summary: contentB
695 |
743 |
696 o changeset: 2:62aaf3f6fc06
744 o changeset: 2:62aaf3f6fc06
697 | parent: 0:f0932f74827e
745 | parent: 0:f0932f74827e
698 | user: test
746 | user: test
699 | date: Thu Jan 01 00:00:00 1970 +0000
747 | date: Thu Jan 01 00:00:00 1970 +0000
700 | summary: unrelated
748 | summary: unrelated
701 |
749 |
702 | o changeset: 1:fd27c222e3e6
750 | o changeset: 1:fd27c222e3e6
703 |/ user: test
751 |/ user: test
704 | date: Thu Jan 01 00:00:00 1970 +0000
752 | date: Thu Jan 01 00:00:00 1970 +0000
705 | summary: contentB
753 | summary: contentB
706 |
754 |
707 o changeset: 0:f0932f74827e
755 o changeset: 0:f0932f74827e
708 user: test
756 user: test
709 date: Thu Jan 01 00:00:00 1970 +0000
757 date: Thu Jan 01 00:00:00 1970 +0000
710 summary: contentA
758 summary: contentA
711
759
712
760
713 Annotate should list ancestor of starting revision only
761 Annotate should list ancestor of starting revision only
714
762
715 $ hg annotate a
763 $ hg annotate a
716 0: A
764 0: A
717 3: B
765 3: B
718 4: C
766 4: C
719
767
720 $ hg annotate a -r 'wdir()'
768 $ hg annotate a -r 'wdir()'
721 0 : A
769 0 : A
722 3 : B
770 3 : B
723 4 : C
771 4 : C
724 4+: W
772 4+: W
725
773
726 Even when the starting revision is the linkrev-shadowed one:
774 Even when the starting revision is the linkrev-shadowed one:
727
775
728 $ hg annotate a -r 3
776 $ hg annotate a -r 3
729 0: A
777 0: A
730 3: B
778 3: B
731
779
732 $ cd ..
780 $ cd ..
733
781
734 Issue5360: Deleted chunk in p1 of a merge changeset
782 Issue5360: Deleted chunk in p1 of a merge changeset
735
783
736 $ hg init repo-5360
784 $ hg init repo-5360
737 $ cd repo-5360
785 $ cd repo-5360
738 $ echo 1 > a
786 $ echo 1 > a
739 $ hg commit -A a -m 1
787 $ hg commit -A a -m 1
740 $ echo 2 >> a
788 $ echo 2 >> a
741 $ hg commit -m 2
789 $ hg commit -m 2
742 $ echo a > a
790 $ echo a > a
743 $ hg commit -m a
791 $ hg commit -m a
744 $ hg update '.^' -q
792 $ hg update '.^' -q
745 $ echo 3 >> a
793 $ echo 3 >> a
746 $ hg commit -m 3 -q
794 $ hg commit -m 3 -q
747 $ hg merge 2 -q
795 $ hg merge 2 -q
796 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
797 [1]
798 $ cat a
799 <<<<<<< working copy: 0a068f0261cf - test: 3
800 1
801 2
802 3
803 ||||||| base
804 1
805 2
806 =======
807 a
808 >>>>>>> merge rev: 9409851bc20a - test: a
748 $ cat > a << EOF
809 $ cat > a << EOF
749 > b
810 > b
750 > 1
811 > 1
751 > 2
812 > 2
752 > 3
813 > 3
753 > a
814 > a
754 > EOF
815 > EOF
755 $ hg resolve --mark -q
816 $ hg resolve --mark -q
817 $ rm a.orig
756 $ hg commit -m m
818 $ hg commit -m m
757 $ hg annotate a
819 $ hg annotate a
758 4: b
820 4: b
759 0: 1
821 0: 1
760 1: 2
822 1: 2
761 3: 3
823 3: 3
762 2: a
824 2: a
763
825
764 $ cd ..
826 $ cd ..
@@ -1,182 +1,180 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > fastannotate=
3 > fastannotate=
4 > [fastannotate]
4 > [fastannotate]
5 > perfhack=1
5 > perfhack=1
6 > EOF
6 > EOF
7
7
8 $ HGMERGE=true; export HGMERGE
9
10 $ hg init repo
8 $ hg init repo
11 $ cd repo
9 $ cd repo
12
10
13 a simple merge case
11 a simple merge case
14
12
15 $ echo 1 > a
13 $ echo 1 > a
16 $ hg commit -qAm 'append 1'
14 $ hg commit -qAm 'append 1'
17 $ echo 2 >> a
15 $ echo 2 >> a
18 $ hg commit -m 'append 2'
16 $ hg commit -m 'append 2'
19 $ echo 3 >> a
17 $ echo 3 >> a
20 $ hg commit -m 'append 3'
18 $ hg commit -m 'append 3'
21 $ hg up 1 -q
19 $ hg up 1 -q
22 $ cat > a << EOF
20 $ cat > a << EOF
23 > 0
21 > 0
24 > 1
22 > 1
25 > 2
23 > 2
26 > EOF
24 > EOF
27 $ hg commit -qm 'insert 0'
25 $ hg commit -qm 'insert 0'
28 $ hg merge 2 -q
26 $ hg merge 2 -q
29 $ echo 4 >> a
27 $ echo 4 >> a
30 $ hg commit -m merge
28 $ hg commit -m merge
31 $ hg log -G -T '{rev}: {desc}'
29 $ hg log -G -T '{rev}: {desc}'
32 @ 4: merge
30 @ 4: merge
33 |\
31 |\
34 | o 3: insert 0
32 | o 3: insert 0
35 | |
33 | |
36 o | 2: append 3
34 o | 2: append 3
37 |/
35 |/
38 o 1: append 2
36 o 1: append 2
39 |
37 |
40 o 0: append 1
38 o 0: append 1
41
39
42 $ hg fastannotate a
40 $ hg fastannotate a
43 3: 0
41 3: 0
44 0: 1
42 0: 1
45 1: 2
43 1: 2
46 2: 3
44 2: 3
47 4: 4
45 4: 4
48 $ hg fastannotate -r 0 a
46 $ hg fastannotate -r 0 a
49 0: 1
47 0: 1
50 $ hg fastannotate -r 1 a
48 $ hg fastannotate -r 1 a
51 0: 1
49 0: 1
52 1: 2
50 1: 2
53 $ hg fastannotate -udnclf a
51 $ hg fastannotate -udnclf a
54 test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
52 test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
55 test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
53 test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
56 test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
54 test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
57 test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
55 test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
58 test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
56 test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
59 $ hg fastannotate --linear a
57 $ hg fastannotate --linear a
60 3: 0
58 3: 0
61 0: 1
59 0: 1
62 1: 2
60 1: 2
63 4: 3
61 4: 3
64 4: 4
62 4: 4
65
63
66 incrementally updating
64 incrementally updating
67
65
68 $ hg fastannotate -r 0 a --debug
66 $ hg fastannotate -r 0 a --debug
69 fastannotate: a: using fast path (resolved fctx: True)
67 fastannotate: a: using fast path (resolved fctx: True)
70 0: 1
68 0: 1
71 $ hg fastannotate -r 0 a --debug --rebuild
69 $ hg fastannotate -r 0 a --debug --rebuild
72 fastannotate: a: 1 new changesets in the main branch
70 fastannotate: a: 1 new changesets in the main branch
73 0: 1
71 0: 1
74 $ hg fastannotate -r 1 a --debug
72 $ hg fastannotate -r 1 a --debug
75 fastannotate: a: 1 new changesets in the main branch
73 fastannotate: a: 1 new changesets in the main branch
76 0: 1
74 0: 1
77 1: 2
75 1: 2
78 $ hg fastannotate -r 3 a --debug
76 $ hg fastannotate -r 3 a --debug
79 fastannotate: a: 1 new changesets in the main branch
77 fastannotate: a: 1 new changesets in the main branch
80 3: 0
78 3: 0
81 0: 1
79 0: 1
82 1: 2
80 1: 2
83 $ hg fastannotate -r 4 a --debug
81 $ hg fastannotate -r 4 a --debug
84 fastannotate: a: 1 new changesets in the main branch
82 fastannotate: a: 1 new changesets in the main branch
85 3: 0
83 3: 0
86 0: 1
84 0: 1
87 1: 2
85 1: 2
88 2: 3
86 2: 3
89 4: 4
87 4: 4
90 $ hg fastannotate -r 1 a --debug
88 $ hg fastannotate -r 1 a --debug
91 fastannotate: a: using fast path (resolved fctx: True)
89 fastannotate: a: using fast path (resolved fctx: True)
92 0: 1
90 0: 1
93 1: 2
91 1: 2
94
92
95 rebuild happens automatically if unable to update
93 rebuild happens automatically if unable to update
96
94
97 $ hg fastannotate -r 2 a --debug
95 $ hg fastannotate -r 2 a --debug
98 fastannotate: a: cache broken and deleted
96 fastannotate: a: cache broken and deleted
99 fastannotate: a: 3 new changesets in the main branch
97 fastannotate: a: 3 new changesets in the main branch
100 0: 1
98 0: 1
101 1: 2
99 1: 2
102 2: 3
100 2: 3
103
101
104 config option "fastannotate.mainbranch"
102 config option "fastannotate.mainbranch"
105
103
106 $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
104 $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
107 fastannotate: a: 4 new changesets in the main branch
105 fastannotate: a: 4 new changesets in the main branch
108 0: 1
106 0: 1
109 1: 2
107 1: 2
110 $ hg fastannotate -r 4 a --debug
108 $ hg fastannotate -r 4 a --debug
111 fastannotate: a: using fast path (resolved fctx: True)
109 fastannotate: a: using fast path (resolved fctx: True)
112 3: 0
110 3: 0
113 0: 1
111 0: 1
114 1: 2
112 1: 2
115 2: 3
113 2: 3
116 4: 4
114 4: 4
117
115
118 rename
116 rename
119
117
120 $ hg mv a b
118 $ hg mv a b
121 $ cat > b << EOF
119 $ cat > b << EOF
122 > 0
120 > 0
123 > 11
121 > 11
124 > 3
122 > 3
125 > 44
123 > 44
126 > EOF
124 > EOF
127 $ hg commit -m b -q
125 $ hg commit -m b -q
128 $ hg fastannotate -ncf --long-hash b
126 $ hg fastannotate -ncf --long-hash b
129 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
127 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
130 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
128 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
131 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
129 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
132 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
130 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
133 $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
131 $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
134 0: 1
132 0: 1
135 1: 2
133 1: 2
136 2: 3
134 2: 3
137
135
138 fastannotate --deleted
136 fastannotate --deleted
139
137
140 $ hg fastannotate --deleted -nf b
138 $ hg fastannotate --deleted -nf b
141 3 a: 0
139 3 a: 0
142 5 b: 11
140 5 b: 11
143 0 a: -1
141 0 a: -1
144 1 a: -2
142 1 a: -2
145 2 a: 3
143 2 a: 3
146 5 b: 44
144 5 b: 44
147 4 a: -4
145 4 a: -4
148 $ hg fastannotate --deleted -r 3 -nf a
146 $ hg fastannotate --deleted -r 3 -nf a
149 3 a: 0
147 3 a: 0
150 0 a: 1
148 0 a: 1
151 1 a: 2
149 1 a: 2
152
150
153 file and directories with ".l", ".m" suffixes
151 file and directories with ".l", ".m" suffixes
154
152
155 $ cd ..
153 $ cd ..
156 $ hg init repo2
154 $ hg init repo2
157 $ cd repo2
155 $ cd repo2
158
156
159 $ mkdir a.l b.m c.lock a.l.hg b.hg
157 $ mkdir a.l b.m c.lock a.l.hg b.hg
160 $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
158 $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
161 > echo $i > $i
159 > echo $i > $i
162 > done
160 > done
163 $ hg add . -q
161 $ hg add . -q
164 $ hg commit -m init
162 $ hg commit -m init
165 $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
163 $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
166 0: a
164 0: a
167 0: a.l.hg/a
165 0: a.l.hg/a
168 0: a.l/a
166 0: a.l/a
169 0: b
167 0: b
170 0: b.hg/a
168 0: b.hg/a
171 0: b.m/a
169 0: b.m/a
172 0: c
170 0: c
173 0: c.lock/a
171 0: c.lock/a
174 0: d
172 0: d
175 0: d.l
173 0: d.l
176 0: d.m
174 0: d.m
177
175
178 empty file
176 empty file
179
177
180 $ touch empty
178 $ touch empty
181 $ hg commit -A empty -m empty
179 $ hg commit -A empty -m empty
182 $ hg fastannotate empty
180 $ hg fastannotate empty
@@ -1,211 +1,209 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [ui]
2 > [ui]
3 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
3 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
4 > [extensions]
4 > [extensions]
5 > fastannotate=
5 > fastannotate=
6 > [fastannotate]
6 > [fastannotate]
7 > mainbranch=@
7 > mainbranch=@
8 > EOF
8 > EOF
9
9
10 $ HGMERGE=true; export HGMERGE
11
12 setup the server repo
10 setup the server repo
13
11
14 $ hg init repo-server
12 $ hg init repo-server
15 $ cd repo-server
13 $ cd repo-server
16 $ cat >> .hg/hgrc << EOF
14 $ cat >> .hg/hgrc << EOF
17 > [fastannotate]
15 > [fastannotate]
18 > server=1
16 > server=1
19 > EOF
17 > EOF
20 $ for i in 1 2 3 4; do
18 $ for i in 1 2 3 4; do
21 > echo $i >> a
19 > echo $i >> a
22 > hg commit -A -m $i a
20 > hg commit -A -m $i a
23 > done
21 > done
24 $ [ -d .hg/fastannotate ]
22 $ [ -d .hg/fastannotate ]
25 [1]
23 [1]
26 $ hg bookmark @
24 $ hg bookmark @
27 $ cd ..
25 $ cd ..
28
26
29 setup the local repo
27 setup the local repo
30
28
31 $ hg clone 'ssh://user@dummy/repo-server' repo-local -q
29 $ hg clone 'ssh://user@dummy/repo-server' repo-local -q
32 $ cd repo-local
30 $ cd repo-local
33 $ cat >> .hg/hgrc << EOF
31 $ cat >> .hg/hgrc << EOF
34 > [fastannotate]
32 > [fastannotate]
35 > client=1
33 > client=1
36 > clientfetchthreshold=0
34 > clientfetchthreshold=0
37 > EOF
35 > EOF
38 $ [ -d .hg/fastannotate ]
36 $ [ -d .hg/fastannotate ]
39 [1]
37 [1]
40 $ hg fastannotate a --debug
38 $ hg fastannotate a --debug
41 running * (glob)
39 running * (glob)
42 sending hello command
40 sending hello command
43 sending between command
41 sending between command
44 remote: * (glob) (?)
42 remote: * (glob) (?)
45 remote: capabilities: * (glob)
43 remote: capabilities: * (glob)
46 remote: * (glob) (?)
44 remote: * (glob) (?)
47 sending protocaps command
45 sending protocaps command
48 fastannotate: requesting 1 files
46 fastannotate: requesting 1 files
49 sending getannotate command
47 sending getannotate command
50 fastannotate: writing 112 bytes to fastannotate/default/a.l
48 fastannotate: writing 112 bytes to fastannotate/default/a.l
51 fastannotate: writing 94 bytes to fastannotate/default/a.m
49 fastannotate: writing 94 bytes to fastannotate/default/a.m
52 fastannotate: a: using fast path (resolved fctx: True)
50 fastannotate: a: using fast path (resolved fctx: True)
53 0: 1
51 0: 1
54 1: 2
52 1: 2
55 2: 3
53 2: 3
56 3: 4
54 3: 4
57
55
58 the cache could be reused and no download is necessary
56 the cache could be reused and no download is necessary
59
57
60 $ hg fastannotate a --debug
58 $ hg fastannotate a --debug
61 fastannotate: a: using fast path (resolved fctx: True)
59 fastannotate: a: using fast path (resolved fctx: True)
62 0: 1
60 0: 1
63 1: 2
61 1: 2
64 2: 3
62 2: 3
65 3: 4
63 3: 4
66
64
67 if the client agrees where the head of the master branch is, no re-download
65 if the client agrees where the head of the master branch is, no re-download
68 happens even if the client has more commits
66 happens even if the client has more commits
69
67
70 $ echo 5 >> a
68 $ echo 5 >> a
71 $ hg commit -m 5
69 $ hg commit -m 5
72 $ hg bookmark -r 3 @ -f
70 $ hg bookmark -r 3 @ -f
73 $ hg fastannotate a --debug
71 $ hg fastannotate a --debug
74 0: 1
72 0: 1
75 1: 2
73 1: 2
76 2: 3
74 2: 3
77 3: 4
75 3: 4
78 4: 5
76 4: 5
79
77
80 if the client has a different "@" (head of the master branch) and "@" is ahead
78 if the client has a different "@" (head of the master branch) and "@" is ahead
81 of the server, the server can detect things are unchanged and does not return
79 of the server, the server can detect things are unchanged and does not return
82 full contents (not that there is no "writing ... to fastannotate"), but the
80 full contents (not that there is no "writing ... to fastannotate"), but the
83 client can also build things up on its own (causing diverge)
81 client can also build things up on its own (causing diverge)
84
82
85 $ hg bookmark -r 4 @ -f
83 $ hg bookmark -r 4 @ -f
86 $ hg fastannotate a --debug
84 $ hg fastannotate a --debug
87 running * (glob)
85 running * (glob)
88 sending hello command
86 sending hello command
89 sending between command
87 sending between command
90 remote: * (glob) (?)
88 remote: * (glob) (?)
91 remote: capabilities: * (glob)
89 remote: capabilities: * (glob)
92 remote: * (glob) (?)
90 remote: * (glob) (?)
93 sending protocaps command
91 sending protocaps command
94 fastannotate: requesting 1 files
92 fastannotate: requesting 1 files
95 sending getannotate command
93 sending getannotate command
96 fastannotate: a: 1 new changesets in the main branch
94 fastannotate: a: 1 new changesets in the main branch
97 0: 1
95 0: 1
98 1: 2
96 1: 2
99 2: 3
97 2: 3
100 3: 4
98 3: 4
101 4: 5
99 4: 5
102
100
103 if the client has a different "@" which is behind the server. no download is
101 if the client has a different "@" which is behind the server. no download is
104 necessary
102 necessary
105
103
106 $ hg fastannotate a --debug --config fastannotate.mainbranch=2
104 $ hg fastannotate a --debug --config fastannotate.mainbranch=2
107 fastannotate: a: using fast path (resolved fctx: True)
105 fastannotate: a: using fast path (resolved fctx: True)
108 0: 1
106 0: 1
109 1: 2
107 1: 2
110 2: 3
108 2: 3
111 3: 4
109 3: 4
112 4: 5
110 4: 5
113
111
114 define fastannotate on-disk paths
112 define fastannotate on-disk paths
115
113
116 $ p1=.hg/fastannotate/default
114 $ p1=.hg/fastannotate/default
117 $ p2=../repo-server/.hg/fastannotate/default
115 $ p2=../repo-server/.hg/fastannotate/default
118
116
119 revert bookmark change so the client is behind the server
117 revert bookmark change so the client is behind the server
120
118
121 $ hg bookmark -r 2 @ -f
119 $ hg bookmark -r 2 @ -f
122
120
123 in the "fctx" mode with the "annotate" command, the client also downloads the
121 in the "fctx" mode with the "annotate" command, the client also downloads the
124 cache. but not in the (default) "fastannotate" mode.
122 cache. but not in the (default) "fastannotate" mode.
125
123
126 $ rm $p1/a.l $p1/a.m
124 $ rm $p1/a.l $p1/a.m
127 $ hg annotate a --debug | grep 'fastannotate: writing'
125 $ hg annotate a --debug | grep 'fastannotate: writing'
128 [1]
126 [1]
129 $ hg annotate a --config fastannotate.modes=fctx --debug | grep 'fastannotate: writing' | sort
127 $ hg annotate a --config fastannotate.modes=fctx --debug | grep 'fastannotate: writing' | sort
130 fastannotate: writing 112 bytes to fastannotate/default/a.l
128 fastannotate: writing 112 bytes to fastannotate/default/a.l
131 fastannotate: writing 94 bytes to fastannotate/default/a.m
129 fastannotate: writing 94 bytes to fastannotate/default/a.m
132
130
133 the fastannotate cache (built server-side, downloaded client-side) in two repos
131 the fastannotate cache (built server-side, downloaded client-side) in two repos
134 have the same content (because the client downloads from the server)
132 have the same content (because the client downloads from the server)
135
133
136 $ diff $p1/a.l $p2/a.l
134 $ diff $p1/a.l $p2/a.l
137 $ diff $p1/a.m $p2/a.m
135 $ diff $p1/a.m $p2/a.m
138
136
139 in the "fctx" mode, the client could also build the cache locally
137 in the "fctx" mode, the client could also build the cache locally
140
138
141 $ hg annotate a --config fastannotate.modes=fctx --debug --config fastannotate.mainbranch=4 | grep fastannotate
139 $ hg annotate a --config fastannotate.modes=fctx --debug --config fastannotate.mainbranch=4 | grep fastannotate
142 fastannotate: requesting 1 files
140 fastannotate: requesting 1 files
143 fastannotate: a: 1 new changesets in the main branch
141 fastannotate: a: 1 new changesets in the main branch
144
142
145 the server would rebuild broken cache automatically
143 the server would rebuild broken cache automatically
146
144
147 $ cp $p2/a.m $p2/a.m.bak
145 $ cp $p2/a.m $p2/a.m.bak
148 $ echo BROKEN1 > $p1/a.m
146 $ echo BROKEN1 > $p1/a.m
149 $ echo BROKEN2 > $p2/a.m
147 $ echo BROKEN2 > $p2/a.m
150 $ hg fastannotate a --debug | grep 'fastannotate: writing' | sort
148 $ hg fastannotate a --debug | grep 'fastannotate: writing' | sort
151 fastannotate: writing 112 bytes to fastannotate/default/a.l
149 fastannotate: writing 112 bytes to fastannotate/default/a.l
152 fastannotate: writing 94 bytes to fastannotate/default/a.m
150 fastannotate: writing 94 bytes to fastannotate/default/a.m
153 $ diff $p1/a.m $p2/a.m
151 $ diff $p1/a.m $p2/a.m
154 $ diff $p2/a.m $p2/a.m.bak
152 $ diff $p2/a.m $p2/a.m.bak
155
153
156 use the "debugbuildannotatecache" command to build annotate cache
154 use the "debugbuildannotatecache" command to build annotate cache
157
155
158 $ rm -rf $p1 $p2
156 $ rm -rf $p1 $p2
159 $ hg --cwd ../repo-server debugbuildannotatecache a --debug
157 $ hg --cwd ../repo-server debugbuildannotatecache a --debug
160 fastannotate: a: 4 new changesets in the main branch
158 fastannotate: a: 4 new changesets in the main branch
161 $ hg --cwd ../repo-local debugbuildannotatecache a --debug
159 $ hg --cwd ../repo-local debugbuildannotatecache a --debug
162 running * (glob)
160 running * (glob)
163 sending hello command
161 sending hello command
164 sending between command
162 sending between command
165 remote: * (glob) (?)
163 remote: * (glob) (?)
166 remote: capabilities: * (glob)
164 remote: capabilities: * (glob)
167 remote: * (glob) (?)
165 remote: * (glob) (?)
168 sending protocaps command
166 sending protocaps command
169 fastannotate: requesting 1 files
167 fastannotate: requesting 1 files
170 sending getannotate command
168 sending getannotate command
171 fastannotate: writing * (glob)
169 fastannotate: writing * (glob)
172 fastannotate: writing * (glob)
170 fastannotate: writing * (glob)
173 $ diff $p1/a.l $p2/a.l
171 $ diff $p1/a.l $p2/a.l
174 $ diff $p1/a.m $p2/a.m
172 $ diff $p1/a.m $p2/a.m
175
173
176 with the clientfetchthreshold config option, the client can build up the cache
174 with the clientfetchthreshold config option, the client can build up the cache
177 without downloading from the server
175 without downloading from the server
178
176
179 $ rm -rf $p1
177 $ rm -rf $p1
180 $ hg fastannotate a --debug --config fastannotate.clientfetchthreshold=10
178 $ hg fastannotate a --debug --config fastannotate.clientfetchthreshold=10
181 fastannotate: a: 3 new changesets in the main branch
179 fastannotate: a: 3 new changesets in the main branch
182 0: 1
180 0: 1
183 1: 2
181 1: 2
184 2: 3
182 2: 3
185 3: 4
183 3: 4
186 4: 5
184 4: 5
187
185
188 if the fastannotate directory is not writable, the fctx mode still works
186 if the fastannotate directory is not writable, the fctx mode still works
189
187
190 $ rm -rf $p1
188 $ rm -rf $p1
191 $ touch $p1
189 $ touch $p1
192 $ hg annotate a --debug --traceback --config fastannotate.modes=fctx
190 $ hg annotate a --debug --traceback --config fastannotate.modes=fctx
193 fastannotate: a: cache broken and deleted
191 fastannotate: a: cache broken and deleted
194 fastannotate: prefetch failed: * (glob)
192 fastannotate: prefetch failed: * (glob)
195 fastannotate: a: cache broken and deleted
193 fastannotate: a: cache broken and deleted
196 fastannotate: falling back to the vanilla annotate: * (glob)
194 fastannotate: falling back to the vanilla annotate: * (glob)
197 0: 1
195 0: 1
198 1: 2
196 1: 2
199 2: 3
197 2: 3
200 3: 4
198 3: 4
201 4: 5
199 4: 5
202
200
203 with serverbuildondemand=False, the server will not build anything
201 with serverbuildondemand=False, the server will not build anything
204
202
205 $ cat >> ../repo-server/.hg/hgrc <<EOF
203 $ cat >> ../repo-server/.hg/hgrc <<EOF
206 > [fastannotate]
204 > [fastannotate]
207 > serverbuildondemand=False
205 > serverbuildondemand=False
208 > EOF
206 > EOF
209 $ rm -rf $p1 $p2
207 $ rm -rf $p1 $p2
210 $ hg fastannotate a --debug | grep 'fastannotate: writing'
208 $ hg fastannotate a --debug | grep 'fastannotate: writing'
211 [1]
209 [1]
@@ -1,263 +1,261 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > fastannotate=
3 > fastannotate=
4 > EOF
4 > EOF
5
5
6 $ HGMERGE=true; export HGMERGE
7
8 $ hg init repo
6 $ hg init repo
9 $ cd repo
7 $ cd repo
10
8
11 a simple merge case
9 a simple merge case
12
10
13 $ echo 1 > a
11 $ echo 1 > a
14 $ hg commit -qAm 'append 1'
12 $ hg commit -qAm 'append 1'
15 $ echo 2 >> a
13 $ echo 2 >> a
16 $ hg commit -m 'append 2'
14 $ hg commit -m 'append 2'
17 $ echo 3 >> a
15 $ echo 3 >> a
18 $ hg commit -m 'append 3'
16 $ hg commit -m 'append 3'
19 $ hg up 1 -q
17 $ hg up 1 -q
20 $ cat > a << EOF
18 $ cat > a << EOF
21 > 0
19 > 0
22 > 1
20 > 1
23 > 2
21 > 2
24 > EOF
22 > EOF
25 $ hg commit -qm 'insert 0'
23 $ hg commit -qm 'insert 0'
26 $ hg merge 2 -q
24 $ hg merge 2 -q
27 $ echo 4 >> a
25 $ echo 4 >> a
28 $ hg commit -m merge
26 $ hg commit -m merge
29 $ hg log -G -T '{rev}: {desc}'
27 $ hg log -G -T '{rev}: {desc}'
30 @ 4: merge
28 @ 4: merge
31 |\
29 |\
32 | o 3: insert 0
30 | o 3: insert 0
33 | |
31 | |
34 o | 2: append 3
32 o | 2: append 3
35 |/
33 |/
36 o 1: append 2
34 o 1: append 2
37 |
35 |
38 o 0: append 1
36 o 0: append 1
39
37
40 $ hg fastannotate a
38 $ hg fastannotate a
41 3: 0
39 3: 0
42 0: 1
40 0: 1
43 1: 2
41 1: 2
44 2: 3
42 2: 3
45 4: 4
43 4: 4
46 $ hg fastannotate -r 0 a
44 $ hg fastannotate -r 0 a
47 0: 1
45 0: 1
48 $ hg fastannotate -r 1 a
46 $ hg fastannotate -r 1 a
49 0: 1
47 0: 1
50 1: 2
48 1: 2
51 $ hg fastannotate -udnclf a
49 $ hg fastannotate -udnclf a
52 test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
50 test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
53 test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
51 test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
54 test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
52 test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
55 test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
53 test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
56 test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
54 test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
57 $ hg fastannotate --linear a
55 $ hg fastannotate --linear a
58 3: 0
56 3: 0
59 0: 1
57 0: 1
60 1: 2
58 1: 2
61 4: 3
59 4: 3
62 4: 4
60 4: 4
63
61
64 incrementally updating
62 incrementally updating
65
63
66 $ hg fastannotate -r 0 a --debug
64 $ hg fastannotate -r 0 a --debug
67 fastannotate: a: using fast path (resolved fctx: True)
65 fastannotate: a: using fast path (resolved fctx: True)
68 0: 1
66 0: 1
69 $ hg fastannotate -r 0 a --debug --rebuild
67 $ hg fastannotate -r 0 a --debug --rebuild
70 fastannotate: a: 1 new changesets in the main branch
68 fastannotate: a: 1 new changesets in the main branch
71 0: 1
69 0: 1
72 $ hg fastannotate -r 1 a --debug
70 $ hg fastannotate -r 1 a --debug
73 fastannotate: a: 1 new changesets in the main branch
71 fastannotate: a: 1 new changesets in the main branch
74 0: 1
72 0: 1
75 1: 2
73 1: 2
76 $ hg fastannotate -r 3 a --debug
74 $ hg fastannotate -r 3 a --debug
77 fastannotate: a: 1 new changesets in the main branch
75 fastannotate: a: 1 new changesets in the main branch
78 3: 0
76 3: 0
79 0: 1
77 0: 1
80 1: 2
78 1: 2
81 $ hg fastannotate -r 4 a --debug
79 $ hg fastannotate -r 4 a --debug
82 fastannotate: a: 1 new changesets in the main branch
80 fastannotate: a: 1 new changesets in the main branch
83 3: 0
81 3: 0
84 0: 1
82 0: 1
85 1: 2
83 1: 2
86 2: 3
84 2: 3
87 4: 4
85 4: 4
88 $ hg fastannotate -r 1 a --debug
86 $ hg fastannotate -r 1 a --debug
89 fastannotate: a: using fast path (resolved fctx: True)
87 fastannotate: a: using fast path (resolved fctx: True)
90 0: 1
88 0: 1
91 1: 2
89 1: 2
92
90
93 rebuild happens automatically if unable to update
91 rebuild happens automatically if unable to update
94
92
95 $ hg fastannotate -r 2 a --debug
93 $ hg fastannotate -r 2 a --debug
96 fastannotate: a: cache broken and deleted
94 fastannotate: a: cache broken and deleted
97 fastannotate: a: 3 new changesets in the main branch
95 fastannotate: a: 3 new changesets in the main branch
98 0: 1
96 0: 1
99 1: 2
97 1: 2
100 2: 3
98 2: 3
101
99
102 config option "fastannotate.mainbranch"
100 config option "fastannotate.mainbranch"
103
101
104 $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
102 $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
105 fastannotate: a: 4 new changesets in the main branch
103 fastannotate: a: 4 new changesets in the main branch
106 0: 1
104 0: 1
107 1: 2
105 1: 2
108 $ hg fastannotate -r 4 a --debug
106 $ hg fastannotate -r 4 a --debug
109 fastannotate: a: using fast path (resolved fctx: True)
107 fastannotate: a: using fast path (resolved fctx: True)
110 3: 0
108 3: 0
111 0: 1
109 0: 1
112 1: 2
110 1: 2
113 2: 3
111 2: 3
114 4: 4
112 4: 4
115
113
116 config option "fastannotate.modes"
114 config option "fastannotate.modes"
117
115
118 $ hg annotate -r 1 --debug a
116 $ hg annotate -r 1 --debug a
119 0: 1
117 0: 1
120 1: 2
118 1: 2
121 $ hg annotate --config fastannotate.modes=fctx -r 1 --debug a
119 $ hg annotate --config fastannotate.modes=fctx -r 1 --debug a
122 fastannotate: a: using fast path (resolved fctx: False)
120 fastannotate: a: using fast path (resolved fctx: False)
123 0: 1
121 0: 1
124 1: 2
122 1: 2
125 $ hg fastannotate --config fastannotate.modes=fctx -h -q
123 $ hg fastannotate --config fastannotate.modes=fctx -h -q
126 hg: unknown command 'fastannotate'
124 hg: unknown command 'fastannotate'
127 (did you mean *) (glob)
125 (did you mean *) (glob)
128 [255]
126 [255]
129
127
130 rename
128 rename
131
129
132 $ hg mv a b
130 $ hg mv a b
133 $ cat > b << EOF
131 $ cat > b << EOF
134 > 0
132 > 0
135 > 11
133 > 11
136 > 3
134 > 3
137 > 44
135 > 44
138 > EOF
136 > EOF
139 $ hg commit -m b -q
137 $ hg commit -m b -q
140 $ hg fastannotate -ncf --long-hash b
138 $ hg fastannotate -ncf --long-hash b
141 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
139 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
142 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
140 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
143 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
141 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
144 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
142 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
145 $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
143 $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
146 0: 1
144 0: 1
147 1: 2
145 1: 2
148 2: 3
146 2: 3
149
147
150 fastannotate --deleted
148 fastannotate --deleted
151
149
152 $ hg fastannotate --deleted -nf b
150 $ hg fastannotate --deleted -nf b
153 3 a: 0
151 3 a: 0
154 5 b: 11
152 5 b: 11
155 0 a: -1
153 0 a: -1
156 1 a: -2
154 1 a: -2
157 2 a: 3
155 2 a: 3
158 5 b: 44
156 5 b: 44
159 4 a: -4
157 4 a: -4
160 $ hg fastannotate --deleted -r 3 -nf a
158 $ hg fastannotate --deleted -r 3 -nf a
161 3 a: 0
159 3 a: 0
162 0 a: 1
160 0 a: 1
163 1 a: 2
161 1 a: 2
164
162
165 file and directories with ".l", ".m" suffixes
163 file and directories with ".l", ".m" suffixes
166
164
167 $ cd ..
165 $ cd ..
168 $ hg init repo2
166 $ hg init repo2
169 $ cd repo2
167 $ cd repo2
170
168
171 $ mkdir a.l b.m c.lock a.l.hg b.hg
169 $ mkdir a.l b.m c.lock a.l.hg b.hg
172 $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
170 $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
173 > echo $i > $i
171 > echo $i > $i
174 > done
172 > done
175 $ hg add . -q
173 $ hg add . -q
176 $ hg commit -m init
174 $ hg commit -m init
177 $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
175 $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
178 0: a
176 0: a
179 0: a.l.hg/a
177 0: a.l.hg/a
180 0: a.l/a
178 0: a.l/a
181 0: b
179 0: b
182 0: b.hg/a
180 0: b.hg/a
183 0: b.m/a
181 0: b.m/a
184 0: c
182 0: c
185 0: c.lock/a
183 0: c.lock/a
186 0: d
184 0: d
187 0: d.l
185 0: d.l
188 0: d.m
186 0: d.m
189
187
190 empty file
188 empty file
191
189
192 $ touch empty
190 $ touch empty
193 $ hg commit -A empty -m empty
191 $ hg commit -A empty -m empty
194 $ hg fastannotate empty
192 $ hg fastannotate empty
195
193
196 json format
194 json format
197
195
198 $ hg fastannotate -Tjson -cludn b a empty
196 $ hg fastannotate -Tjson -cludn b a empty
199 [
197 [
200 {
198 {
201 "date": [0.0, 0],
199 "date": [0.0, 0],
202 "line": "a\n",
200 "line": "a\n",
203 "line_number": 1,
201 "line_number": 1,
204 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
202 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
205 "rev": 0,
203 "rev": 0,
206 "user": "test"
204 "user": "test"
207 },
205 },
208 {
206 {
209 "date": [0.0, 0],
207 "date": [0.0, 0],
210 "line": "b\n",
208 "line": "b\n",
211 "line_number": 1,
209 "line_number": 1,
212 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
210 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
213 "rev": 0,
211 "rev": 0,
214 "user": "test"
212 "user": "test"
215 }
213 }
216 ]
214 ]
217
215
218 $ hg fastannotate -Tjson -cludn empty
216 $ hg fastannotate -Tjson -cludn empty
219 [
217 [
220 ]
218 ]
221 $ hg fastannotate -Tjson --no-content -n a
219 $ hg fastannotate -Tjson --no-content -n a
222 [
220 [
223 {
221 {
224 "rev": 0
222 "rev": 0
225 }
223 }
226 ]
224 ]
227
225
228 working copy
226 working copy
229
227
230 $ echo a >> a
228 $ echo a >> a
231 $ hg fastannotate -r 'wdir()' a
229 $ hg fastannotate -r 'wdir()' a
232 abort: cannot update linelog to wdir()
230 abort: cannot update linelog to wdir()
233 (set fastannotate.mainbranch)
231 (set fastannotate.mainbranch)
234 [255]
232 [255]
235 $ cat >> $HGRCPATH << EOF
233 $ cat >> $HGRCPATH << EOF
236 > [fastannotate]
234 > [fastannotate]
237 > mainbranch = .
235 > mainbranch = .
238 > EOF
236 > EOF
239 $ hg fastannotate -r 'wdir()' a
237 $ hg fastannotate -r 'wdir()' a
240 0 : a
238 0 : a
241 1+: a
239 1+: a
242 $ hg fastannotate -cludn -r 'wdir()' a
240 $ hg fastannotate -cludn -r 'wdir()' a
243 test 0 1fd620b16252 Thu Jan 01 00:00:00 1970 +0000:1: a
241 test 0 1fd620b16252 Thu Jan 01 00:00:00 1970 +0000:1: a
244 test 1 720582f5bdb6+ *:2: a (glob)
242 test 1 720582f5bdb6+ *:2: a (glob)
245 $ hg fastannotate -cludn -r 'wdir()' -Tjson a
243 $ hg fastannotate -cludn -r 'wdir()' -Tjson a
246 [
244 [
247 {
245 {
248 "date": [0.0, 0],
246 "date": [0.0, 0],
249 "line": "a\n",
247 "line": "a\n",
250 "line_number": 1,
248 "line_number": 1,
251 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
249 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
252 "rev": 0,
250 "rev": 0,
253 "user": "test"
251 "user": "test"
254 },
252 },
255 {
253 {
256 "date": [*, 0], (glob)
254 "date": [*, 0], (glob)
257 "line": "a\n",
255 "line": "a\n",
258 "line_number": 2,
256 "line_number": 2,
259 "node": null,
257 "node": null,
260 "rev": null,
258 "rev": null,
261 "user": "test"
259 "user": "test"
262 }
260 }
263 ]
261 ]
General Comments 0
You need to be logged in to leave comments. Login now