##// END OF EJS Templates
py3: silence f.write() in test-annotate.t
Yuya Nishihara -
r36845:12492794 default
parent child Browse files
Show More
@@ -1,1041 +1,1041 b''
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 (followlines(baz, 2:4, startrev=20, descend=[1])
817 (followlines(baz, 2:4, startrev=20, descend=[1])
818 ^ here)
818 ^ here)
819 [255]
819 [255]
820 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
820 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
821 hg: parse error: descend argument must be a boolean
821 hg: parse error: descend argument must be a boolean
822 [255]
822 [255]
823
823
824 Test empty annotate output
824 Test empty annotate output
825
825
826 $ printf '\0' > binary
826 $ printf '\0' > binary
827 $ touch empty
827 $ touch empty
828 $ hg ci -qAm 'add binary and empty files'
828 $ hg ci -qAm 'add binary and empty files'
829
829
830 $ hg annotate binary empty
830 $ hg annotate binary empty
831 binary: binary file
831 binary: binary file
832
832
833 $ hg annotate -Tjson binary empty
833 $ hg annotate -Tjson binary empty
834 [
834 [
835 {
835 {
836 "abspath": "binary",
836 "abspath": "binary",
837 "path": "binary"
837 "path": "binary"
838 },
838 },
839 {
839 {
840 "abspath": "empty",
840 "abspath": "empty",
841 "lines": [],
841 "lines": [],
842 "path": "empty"
842 "path": "empty"
843 }
843 }
844 ]
844 ]
845
845
846 Test annotate with whitespace options
846 Test annotate with whitespace options
847
847
848 $ cd ..
848 $ cd ..
849 $ hg init repo-ws
849 $ hg init repo-ws
850 $ cd repo-ws
850 $ cd repo-ws
851 $ cat > a <<EOF
851 $ cat > a <<EOF
852 > aa
852 > aa
853 >
853 >
854 > b b
854 > b b
855 > EOF
855 > EOF
856 $ hg ci -Am "adda"
856 $ hg ci -Am "adda"
857 adding a
857 adding a
858 $ sed 's/EOL$//g' > a <<EOF
858 $ sed 's/EOL$//g' > a <<EOF
859 > a a
859 > a a
860 >
860 >
861 > EOL
861 > EOL
862 > b b
862 > b b
863 > EOF
863 > EOF
864 $ hg ci -m "changea"
864 $ hg ci -m "changea"
865
865
866 Annotate with no option
866 Annotate with no option
867
867
868 $ hg annotate a
868 $ hg annotate a
869 1: a a
869 1: a a
870 0:
870 0:
871 1:
871 1:
872 1: b b
872 1: b b
873
873
874 Annotate with --ignore-space-change
874 Annotate with --ignore-space-change
875
875
876 $ hg annotate --ignore-space-change a
876 $ hg annotate --ignore-space-change a
877 1: a a
877 1: a a
878 1:
878 1:
879 0:
879 0:
880 0: b b
880 0: b b
881
881
882 Annotate with --ignore-all-space
882 Annotate with --ignore-all-space
883
883
884 $ hg annotate --ignore-all-space a
884 $ hg annotate --ignore-all-space a
885 0: a a
885 0: a a
886 0:
886 0:
887 1:
887 1:
888 0: b b
888 0: b b
889
889
890 Annotate with --ignore-blank-lines (similar to no options case)
890 Annotate with --ignore-blank-lines (similar to no options case)
891
891
892 $ hg annotate --ignore-blank-lines a
892 $ hg annotate --ignore-blank-lines a
893 1: a a
893 1: a a
894 0:
894 0:
895 1:
895 1:
896 1: b b
896 1: b b
897
897
898 $ cd ..
898 $ cd ..
899
899
900 Annotate with orphaned CR (issue5798)
900 Annotate with orphaned CR (issue5798)
901 -------------------------------------
901 -------------------------------------
902
902
903 $ hg init repo-cr
903 $ hg init repo-cr
904 $ cd repo-cr
904 $ cd repo-cr
905
905
906 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
906 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
907 > import sys
907 > import sys
908 > from mercurial import util
908 > from mercurial import util
909 > util.setbinary(sys.stdin)
909 > util.setbinary(sys.stdin)
910 > util.setbinary(sys.stdout)
910 > util.setbinary(sys.stdout)
911 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
911 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
912 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
912 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
913 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
913 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
914 > EOF
914 > EOF
915
915
916 >>> with open('a', 'wb') as f:
916 >>> with open('a', 'wb') as f:
917 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
917 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
918 $ hg ci -qAm0
918 $ hg ci -qAm0
919 >>> with open('a', 'wb') as f:
919 >>> with open('a', 'wb') as f:
920 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
920 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
921 $ hg ci -m1
921 $ hg ci -m1
922
922
923 $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
923 $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
924 0: 0a[CR]0b[CR]
924 0: 0a[CR]0b[CR]
925 0: 0c[CR]0d[CR]
925 0: 0c[CR]0d[CR]
926 0: 0e
926 0: 0e
927 0: 0f
927 0: 0f
928 0: 0g
928 0: 0g
929 $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
929 $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
930 0: 0a[CR]0b[CR]
930 0: 0a[CR]0b[CR]
931 1: 1c[CR]1d[CR]
931 1: 1c[CR]1d[CR]
932 0: 0e
932 0: 0e
933 1: 1f
933 1: 1f
934 0: 0g
934 0: 0g
935
935
936 $ cd ..
936 $ cd ..
937
937
938 Annotate with linkrev pointing to another branch
938 Annotate with linkrev pointing to another branch
939 ------------------------------------------------
939 ------------------------------------------------
940
940
941 create history with a filerev whose linkrev points to another branch
941 create history with a filerev whose linkrev points to another branch
942
942
943 $ hg init branchedlinkrev
943 $ hg init branchedlinkrev
944 $ cd branchedlinkrev
944 $ cd branchedlinkrev
945 $ echo A > a
945 $ echo A > a
946 $ hg commit -Am 'contentA'
946 $ hg commit -Am 'contentA'
947 adding a
947 adding a
948 $ echo B >> a
948 $ echo B >> a
949 $ hg commit -m 'contentB'
949 $ hg commit -m 'contentB'
950 $ hg up --rev 'desc(contentA)'
950 $ hg up --rev 'desc(contentA)'
951 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
951 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
952 $ echo unrelated > unrelated
952 $ echo unrelated > unrelated
953 $ hg commit -Am 'unrelated'
953 $ hg commit -Am 'unrelated'
954 adding unrelated
954 adding unrelated
955 created new head
955 created new head
956 $ hg graft -r 'desc(contentB)'
956 $ hg graft -r 'desc(contentB)'
957 grafting 1:fd27c222e3e6 "contentB"
957 grafting 1:fd27c222e3e6 "contentB"
958 $ echo C >> a
958 $ echo C >> a
959 $ hg commit -m 'contentC'
959 $ hg commit -m 'contentC'
960 $ echo W >> a
960 $ echo W >> a
961 $ hg log -G
961 $ hg log -G
962 @ changeset: 4:072f1e8df249
962 @ changeset: 4:072f1e8df249
963 | tag: tip
963 | tag: tip
964 | user: test
964 | user: test
965 | date: Thu Jan 01 00:00:00 1970 +0000
965 | date: Thu Jan 01 00:00:00 1970 +0000
966 | summary: contentC
966 | summary: contentC
967 |
967 |
968 o changeset: 3:ff38df03cc4b
968 o changeset: 3:ff38df03cc4b
969 | user: test
969 | user: test
970 | date: Thu Jan 01 00:00:00 1970 +0000
970 | date: Thu Jan 01 00:00:00 1970 +0000
971 | summary: contentB
971 | summary: contentB
972 |
972 |
973 o changeset: 2:62aaf3f6fc06
973 o changeset: 2:62aaf3f6fc06
974 | parent: 0:f0932f74827e
974 | parent: 0:f0932f74827e
975 | user: test
975 | user: test
976 | date: Thu Jan 01 00:00:00 1970 +0000
976 | date: Thu Jan 01 00:00:00 1970 +0000
977 | summary: unrelated
977 | summary: unrelated
978 |
978 |
979 | o changeset: 1:fd27c222e3e6
979 | o changeset: 1:fd27c222e3e6
980 |/ user: test
980 |/ user: test
981 | date: Thu Jan 01 00:00:00 1970 +0000
981 | date: Thu Jan 01 00:00:00 1970 +0000
982 | summary: contentB
982 | summary: contentB
983 |
983 |
984 o changeset: 0:f0932f74827e
984 o changeset: 0:f0932f74827e
985 user: test
985 user: test
986 date: Thu Jan 01 00:00:00 1970 +0000
986 date: Thu Jan 01 00:00:00 1970 +0000
987 summary: contentA
987 summary: contentA
988
988
989
989
990 Annotate should list ancestor of starting revision only
990 Annotate should list ancestor of starting revision only
991
991
992 $ hg annotate a
992 $ hg annotate a
993 0: A
993 0: A
994 3: B
994 3: B
995 4: C
995 4: C
996
996
997 $ hg annotate a -r 'wdir()'
997 $ hg annotate a -r 'wdir()'
998 0 : A
998 0 : A
999 3 : B
999 3 : B
1000 4 : C
1000 4 : C
1001 4+: W
1001 4+: W
1002
1002
1003 Even when the starting revision is the linkrev-shadowed one:
1003 Even when the starting revision is the linkrev-shadowed one:
1004
1004
1005 $ hg annotate a -r 3
1005 $ hg annotate a -r 3
1006 0: A
1006 0: A
1007 3: B
1007 3: B
1008
1008
1009 $ cd ..
1009 $ cd ..
1010
1010
1011 Issue5360: Deleted chunk in p1 of a merge changeset
1011 Issue5360: Deleted chunk in p1 of a merge changeset
1012
1012
1013 $ hg init repo-5360
1013 $ hg init repo-5360
1014 $ cd repo-5360
1014 $ cd repo-5360
1015 $ echo 1 > a
1015 $ echo 1 > a
1016 $ hg commit -A a -m 1
1016 $ hg commit -A a -m 1
1017 $ echo 2 >> a
1017 $ echo 2 >> a
1018 $ hg commit -m 2
1018 $ hg commit -m 2
1019 $ echo a > a
1019 $ echo a > a
1020 $ hg commit -m a
1020 $ hg commit -m a
1021 $ hg update '.^' -q
1021 $ hg update '.^' -q
1022 $ echo 3 >> a
1022 $ echo 3 >> a
1023 $ hg commit -m 3 -q
1023 $ hg commit -m 3 -q
1024 $ hg merge 2 -q
1024 $ hg merge 2 -q
1025 $ cat > a << EOF
1025 $ cat > a << EOF
1026 > b
1026 > b
1027 > 1
1027 > 1
1028 > 2
1028 > 2
1029 > 3
1029 > 3
1030 > a
1030 > a
1031 > EOF
1031 > EOF
1032 $ hg resolve --mark -q
1032 $ hg resolve --mark -q
1033 $ hg commit -m m
1033 $ hg commit -m m
1034 $ hg annotate a
1034 $ hg annotate a
1035 4: b
1035 4: b
1036 0: 1
1036 0: 1
1037 1: 2
1037 1: 2
1038 3: 3
1038 3: 3
1039 2: a
1039 2: a
1040
1040
1041 $ cd ..
1041 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now