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