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