##// END OF EJS Templates
test-annotate: conditionalize output instead of tests
Matt Harbison -
r33341:1a4eca3b default
parent child Browse files
Show More
@@ -1,1008 +1,1000
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 mercurial import node, error
403 > from mercurial import node, error
404 > def reposetup(ui, repo):
404 > def reposetup(ui, repo):
405 > class legacyrepo(repo.__class__):
405 > class legacyrepo(repo.__class__):
406 > def _filecommit(self, fctx, manifest1, manifest2,
406 > def _filecommit(self, fctx, manifest1, manifest2,
407 > linkrev, tr, changelist):
407 > linkrev, tr, changelist):
408 > fname = fctx.path()
408 > fname = fctx.path()
409 > text = fctx.data()
409 > text = fctx.data()
410 > flog = self.file(fname)
410 > flog = self.file(fname)
411 > fparent1 = manifest1.get(fname, node.nullid)
411 > fparent1 = manifest1.get(fname, node.nullid)
412 > fparent2 = manifest2.get(fname, node.nullid)
412 > fparent2 = manifest2.get(fname, node.nullid)
413 > meta = {}
413 > meta = {}
414 > copy = fctx.renamed()
414 > copy = fctx.renamed()
415 > if copy and copy[0] != fname:
415 > if copy and copy[0] != fname:
416 > raise error.Abort('copying is not supported')
416 > raise error.Abort('copying is not supported')
417 > if fparent2 != node.nullid:
417 > if fparent2 != node.nullid:
418 > changelist.append(fname)
418 > changelist.append(fname)
419 > return flog.add(text, meta, tr, linkrev,
419 > return flog.add(text, meta, tr, linkrev,
420 > fparent1, fparent2)
420 > fparent1, fparent2)
421 > raise error.Abort('only merging is supported')
421 > raise error.Abort('only merging is supported')
422 > repo.__class__ = legacyrepo
422 > repo.__class__ = legacyrepo
423 > EOF
423 > EOF
424
424
425 $ cat > baz <<EOF
425 $ cat > baz <<EOF
426 > 1
426 > 1
427 > 2
427 > 2
428 > 3
428 > 3
429 > 4
429 > 4
430 > 5
430 > 5
431 > EOF
431 > EOF
432 $ hg add baz
432 $ hg add baz
433 $ hg commit -m "baz:0"
433 $ hg commit -m "baz:0"
434
434
435 $ cat > baz <<EOF
435 $ cat > baz <<EOF
436 > 1 baz:1
436 > 1 baz:1
437 > 2
437 > 2
438 > 3
438 > 3
439 > 4
439 > 4
440 > 5
440 > 5
441 > EOF
441 > EOF
442 $ hg commit -m "baz:1"
442 $ hg commit -m "baz:1"
443
443
444 $ cat > baz <<EOF
444 $ cat > baz <<EOF
445 > 1 baz:1
445 > 1 baz:1
446 > 2 baz:2
446 > 2 baz:2
447 > 3
447 > 3
448 > 4
448 > 4
449 > 5
449 > 5
450 > EOF
450 > EOF
451 $ hg debugsetparents 17 17
451 $ hg debugsetparents 17 17
452 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
452 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
453 $ hg debugindexdot .hg/store/data/baz.i
453 $ hg debugindexdot .hg/store/data/baz.i
454 digraph G {
454 digraph G {
455 -1 -> 0
455 -1 -> 0
456 0 -> 1
456 0 -> 1
457 1 -> 2
457 1 -> 2
458 1 -> 2
458 1 -> 2
459 }
459 }
460 $ hg annotate baz
460 $ hg annotate baz
461 17: 1 baz:1
461 17: 1 baz:1
462 18: 2 baz:2
462 18: 2 baz:2
463 16: 3
463 16: 3
464 16: 4
464 16: 4
465 16: 5
465 16: 5
466
466
467 $ cat > baz <<EOF
467 $ cat > baz <<EOF
468 > 1 baz:1
468 > 1 baz:1
469 > 2 baz:2
469 > 2 baz:2
470 > 3 baz:3
470 > 3 baz:3
471 > 4
471 > 4
472 > 5
472 > 5
473 > EOF
473 > EOF
474 $ hg commit -m "baz:3"
474 $ hg commit -m "baz:3"
475
475
476 $ cat > baz <<EOF
476 $ cat > baz <<EOF
477 > 1 baz:1
477 > 1 baz:1
478 > 2 baz:2
478 > 2 baz:2
479 > 3 baz:3
479 > 3 baz:3
480 > 4 baz:4
480 > 4 baz:4
481 > 5
481 > 5
482 > EOF
482 > EOF
483 $ hg debugsetparents 19 18
483 $ hg debugsetparents 19 18
484 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
484 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
485 $ hg debugindexdot .hg/store/data/baz.i
485 $ hg debugindexdot .hg/store/data/baz.i
486 digraph G {
486 digraph G {
487 -1 -> 0
487 -1 -> 0
488 0 -> 1
488 0 -> 1
489 1 -> 2
489 1 -> 2
490 1 -> 2
490 1 -> 2
491 2 -> 3
491 2 -> 3
492 3 -> 4
492 3 -> 4
493 2 -> 4
493 2 -> 4
494 }
494 }
495 $ hg annotate baz
495 $ hg annotate baz
496 17: 1 baz:1
496 17: 1 baz:1
497 18: 2 baz:2
497 18: 2 baz:2
498 19: 3 baz:3
498 19: 3 baz:3
499 20: 4 baz:4
499 20: 4 baz:4
500 16: 5
500 16: 5
501
501
502 annotate clean file
502 annotate clean file
503
503
504 $ hg annotate -ncr "wdir()" foo
504 $ hg annotate -ncr "wdir()" foo
505 11 472b18db256d : foo
505 11 472b18db256d : foo
506
506
507 annotate modified file
507 annotate modified file
508
508
509 $ echo foofoo >> foo
509 $ echo foofoo >> foo
510 $ hg annotate -r "wdir()" foo
510 $ hg annotate -r "wdir()" foo
511 11 : foo
511 11 : foo
512 20+: foofoo
512 20+: foofoo
513
513
514 $ hg annotate -cr "wdir()" foo
514 $ hg annotate -cr "wdir()" foo
515 472b18db256d : foo
515 472b18db256d : foo
516 b6bedd5477e7+: foofoo
516 b6bedd5477e7+: foofoo
517
517
518 $ hg annotate -ncr "wdir()" foo
518 $ hg annotate -ncr "wdir()" foo
519 11 472b18db256d : foo
519 11 472b18db256d : foo
520 20 b6bedd5477e7+: foofoo
520 20 b6bedd5477e7+: foofoo
521
521
522 $ hg annotate --debug -ncr "wdir()" foo
522 $ hg annotate --debug -ncr "wdir()" foo
523 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
523 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
524 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
524 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
525
525
526 $ hg annotate -udr "wdir()" foo
526 $ hg annotate -udr "wdir()" foo
527 test Thu Jan 01 00:00:00 1970 +0000: foo
527 test Thu Jan 01 00:00:00 1970 +0000: foo
528 test [A-Za-z0-9:+ ]+: foofoo (re)
528 test [A-Za-z0-9:+ ]+: foofoo (re)
529
529
530 $ hg annotate -ncr "wdir()" -Tjson foo
530 $ hg annotate -ncr "wdir()" -Tjson foo
531 [
531 [
532 {
532 {
533 "abspath": "foo",
533 "abspath": "foo",
534 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": null, "rev": null}],
534 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": null, "rev": null}],
535 "path": "foo"
535 "path": "foo"
536 }
536 }
537 ]
537 ]
538
538
539 annotate added file
539 annotate added file
540
540
541 $ echo bar > bar
541 $ echo bar > bar
542 $ hg add bar
542 $ hg add bar
543 $ hg annotate -ncr "wdir()" bar
543 $ hg annotate -ncr "wdir()" bar
544 20 b6bedd5477e7+: bar
544 20 b6bedd5477e7+: bar
545
545
546 annotate renamed file
546 annotate renamed file
547
547
548 $ hg rename foo renamefoo2
548 $ hg rename foo renamefoo2
549 $ hg annotate -ncr "wdir()" renamefoo2
549 $ hg annotate -ncr "wdir()" renamefoo2
550 11 472b18db256d : foo
550 11 472b18db256d : foo
551 20 b6bedd5477e7+: foofoo
551 20 b6bedd5477e7+: foofoo
552
552
553 annotate missing file
553 annotate missing file
554
554
555 $ rm baz
555 $ rm baz
556 #if windows
556
557 $ hg annotate -ncr "wdir()" baz
557 $ hg annotate -ncr "wdir()" baz
558 abort: $TESTTMP\repo\baz: The system cannot find the file specified
558 abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
559 abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
559 [255]
560 [255]
560 #else
561 $ hg annotate -ncr "wdir()" baz
562 abort: No such file or directory: $TESTTMP/repo/baz
563 [255]
564 #endif
565
561
566 annotate removed file
562 annotate removed file
567
563
568 $ hg rm baz
564 $ hg rm baz
569 #if windows
565
570 $ hg annotate -ncr "wdir()" baz
566 $ hg annotate -ncr "wdir()" baz
571 abort: $TESTTMP\repo\baz: The system cannot find the file specified
567 abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
568 abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
572 [255]
569 [255]
573 #else
574 $ hg annotate -ncr "wdir()" baz
575 abort: No such file or directory: $TESTTMP/repo/baz
576 [255]
577 #endif
578
570
579 $ hg revert --all --no-backup --quiet
571 $ hg revert --all --no-backup --quiet
580 $ hg id -n
572 $ hg id -n
581 20
573 20
582
574
583 Test followlines() revset; we usually check both followlines(pat, range) and
575 Test followlines() revset; we usually check both followlines(pat, range) and
584 followlines(pat, range, descend=True) to make sure both give the same result
576 followlines(pat, range, descend=True) to make sure both give the same result
585 when they should.
577 when they should.
586
578
587 $ echo a >> foo
579 $ echo a >> foo
588 $ hg ci -m 'foo: add a'
580 $ hg ci -m 'foo: add a'
589 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
581 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
590 16: baz:0
582 16: baz:0
591 19: baz:3
583 19: baz:3
592 20: baz:4
584 20: baz:4
593 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
585 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
594 16: baz:0
586 16: baz:0
595 19: baz:3
587 19: baz:3
596 20: baz:4
588 20: baz:4
597 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
589 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
598 16: baz:0
590 16: baz:0
599 19: baz:3
591 19: baz:3
600 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
592 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
601 19: baz:3
593 19: baz:3
602 20: baz:4
594 20: baz:4
603 $ printf "0\n0\n" | cat - baz > baz1
595 $ printf "0\n0\n" | cat - baz > baz1
604 $ mv baz1 baz
596 $ mv baz1 baz
605 $ hg ci -m 'added two lines with 0'
597 $ hg ci -m 'added two lines with 0'
606 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
598 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
607 16: baz:0
599 16: baz:0
608 19: baz:3
600 19: baz:3
609 20: baz:4
601 20: baz:4
610 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
602 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
611 19: baz:3
603 19: baz:3
612 20: baz:4
604 20: baz:4
613 $ echo 6 >> baz
605 $ echo 6 >> baz
614 $ hg ci -m 'added line 8'
606 $ hg ci -m 'added line 8'
615 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
607 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
616 16: baz:0
608 16: baz:0
617 19: baz:3
609 19: baz:3
618 20: baz:4
610 20: baz:4
619 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
611 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
620 19: baz:3
612 19: baz:3
621 20: baz:4
613 20: baz:4
622 $ sed 's/3/3+/' baz > baz.new
614 $ sed 's/3/3+/' baz > baz.new
623 $ mv baz.new baz
615 $ mv baz.new baz
624 $ hg ci -m 'baz:3->3+'
616 $ hg ci -m 'baz:3->3+'
625 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
617 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
626 16: baz:0
618 16: baz:0
627 19: baz:3
619 19: baz:3
628 20: baz:4
620 20: baz:4
629 24: baz:3->3+
621 24: baz:3->3+
630 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
622 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
631 19: baz:3
623 19: baz:3
632 20: baz:4
624 20: baz:4
633 24: baz:3->3+
625 24: baz:3->3+
634 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
626 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
635 22: added two lines with 0
627 22: added two lines with 0
636
628
637 file patterns are okay
629 file patterns are okay
638 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
630 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
639 22: added two lines with 0
631 22: added two lines with 0
640
632
641 renames are followed
633 renames are followed
642 $ hg mv baz qux
634 $ hg mv baz qux
643 $ sed 's/4/4+/' qux > qux.new
635 $ sed 's/4/4+/' qux > qux.new
644 $ mv qux.new qux
636 $ mv qux.new qux
645 $ hg ci -m 'qux:4->4+'
637 $ hg ci -m 'qux:4->4+'
646 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
638 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
647 16: baz:0
639 16: baz:0
648 19: baz:3
640 19: baz:3
649 20: baz:4
641 20: baz:4
650 24: baz:3->3+
642 24: baz:3->3+
651 25: qux:4->4+
643 25: qux:4->4+
652
644
653 but are missed when following children
645 but are missed when following children
654 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
646 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
655 24: baz:3->3+
647 24: baz:3->3+
656
648
657 merge
649 merge
658 $ hg up 24 --quiet
650 $ hg up 24 --quiet
659 $ echo 7 >> baz
651 $ echo 7 >> baz
660 $ hg ci -m 'one more line, out of line range'
652 $ hg ci -m 'one more line, out of line range'
661 created new head
653 created new head
662 $ sed 's/3+/3-/' baz > baz.new
654 $ sed 's/3+/3-/' baz > baz.new
663 $ mv baz.new baz
655 $ mv baz.new baz
664 $ hg ci -m 'baz:3+->3-'
656 $ hg ci -m 'baz:3+->3-'
665 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
657 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
666 16: baz:0
658 16: baz:0
667 19: baz:3
659 19: baz:3
668 20: baz:4
660 20: baz:4
669 24: baz:3->3+
661 24: baz:3->3+
670 27: baz:3+->3-
662 27: baz:3+->3-
671 $ hg merge 25
663 $ hg merge 25
672 merging baz and qux to qux
664 merging baz and qux to qux
673 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
665 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
674 (branch merge, don't forget to commit)
666 (branch merge, don't forget to commit)
675 $ hg ci -m merge
667 $ hg ci -m merge
676 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
668 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
677 16: baz:0
669 16: baz:0
678 19: baz:3
670 19: baz:3
679 20: baz:4
671 20: baz:4
680 24: baz:3->3+
672 24: baz:3->3+
681 25: qux:4->4+
673 25: qux:4->4+
682 27: baz:3+->3-
674 27: baz:3+->3-
683 28: merge
675 28: merge
684 $ hg up 25 --quiet
676 $ hg up 25 --quiet
685 $ hg merge 27
677 $ hg merge 27
686 merging qux and baz to qux
678 merging qux and baz to qux
687 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
679 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
688 (branch merge, don't forget to commit)
680 (branch merge, don't forget to commit)
689 $ hg ci -m 'merge from other side'
681 $ hg ci -m 'merge from other side'
690 created new head
682 created new head
691 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
683 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
692 16: baz:0
684 16: baz:0
693 19: baz:3
685 19: baz:3
694 20: baz:4
686 20: baz:4
695 24: baz:3->3+
687 24: baz:3->3+
696 25: qux:4->4+
688 25: qux:4->4+
697 27: baz:3+->3-
689 27: baz:3+->3-
698 29: merge from other side
690 29: merge from other side
699 $ hg up 24 --quiet
691 $ hg up 24 --quiet
700
692
701 we are missing the branch with rename when following children
693 we are missing the branch with rename when following children
702 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
694 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
703 27: baz:3+->3-
695 27: baz:3+->3-
704
696
705 we follow all branches in descending direction
697 we follow all branches in descending direction
706 $ hg up 23 --quiet
698 $ hg up 23 --quiet
707 $ sed 's/3/+3/' baz > baz.new
699 $ sed 's/3/+3/' baz > baz.new
708 $ mv baz.new baz
700 $ mv baz.new baz
709 $ hg ci -m 'baz:3->+3'
701 $ hg ci -m 'baz:3->+3'
710 created new head
702 created new head
711 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
703 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
712 @ 30: baz:3->+3
704 @ 30: baz:3->+3
713 :
705 :
714 : o 27: baz:3+->3-
706 : o 27: baz:3+->3-
715 : :
707 : :
716 : o 24: baz:3->3+
708 : o 24: baz:3->3+
717 :/
709 :/
718 o 20: baz:4
710 o 20: baz:4
719 |\
711 |\
720 | o 19: baz:3
712 | o 19: baz:3
721 |/
713 |/
722 o 18: baz:2
714 o 18: baz:2
723 :
715 :
724 o 16: baz:0
716 o 16: baz:0
725 |
717 |
726 ~
718 ~
727
719
728 Issue5595: on a merge changeset with different line ranges depending on
720 Issue5595: on a merge changeset with different line ranges depending on
729 parent, be conservative and use the surrounding interval to avoid loosing
721 parent, be conservative and use the surrounding interval to avoid loosing
730 track of possible further descendants in specified range.
722 track of possible further descendants in specified range.
731
723
732 $ hg up 23 --quiet
724 $ hg up 23 --quiet
733 $ hg cat baz -r 24
725 $ hg cat baz -r 24
734 0
726 0
735 0
727 0
736 1 baz:1
728 1 baz:1
737 2 baz:2
729 2 baz:2
738 3+ baz:3
730 3+ baz:3
739 4 baz:4
731 4 baz:4
740 5
732 5
741 6
733 6
742 $ cat > baz << EOF
734 $ cat > baz << EOF
743 > 0
735 > 0
744 > 0
736 > 0
745 > a
737 > a
746 > b
738 > b
747 > 3+ baz:3
739 > 3+ baz:3
748 > 4 baz:4
740 > 4 baz:4
749 > y
741 > y
750 > z
742 > z
751 > EOF
743 > EOF
752 $ hg ci -m 'baz: mostly rewrite with some content from 24'
744 $ hg ci -m 'baz: mostly rewrite with some content from 24'
753 created new head
745 created new head
754 $ hg merge --tool :merge-other 24
746 $ hg merge --tool :merge-other 24
755 merging baz
747 merging baz
756 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
748 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
757 (branch merge, don't forget to commit)
749 (branch merge, don't forget to commit)
758 $ hg ci -m 'merge forgetting about baz rewrite'
750 $ hg ci -m 'merge forgetting about baz rewrite'
759 $ cat > baz << EOF
751 $ cat > baz << EOF
760 > 0
752 > 0
761 > 0
753 > 0
762 > 1 baz:1
754 > 1 baz:1
763 > 2+ baz:2
755 > 2+ baz:2
764 > 3+ baz:3
756 > 3+ baz:3
765 > 4 baz:4
757 > 4 baz:4
766 > 5
758 > 5
767 > 6
759 > 6
768 > EOF
760 > EOF
769 $ hg ci -m 'baz: narrow change (2->2+)'
761 $ hg ci -m 'baz: narrow change (2->2+)'
770 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
762 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
771 @ 33: baz: narrow change (2->2+)
763 @ 33: baz: narrow change (2->2+)
772 |
764 |
773 o 32: merge forgetting about baz rewrite
765 o 32: merge forgetting about baz rewrite
774 |\
766 |\
775 | o 31: baz: mostly rewrite with some content from 24
767 | o 31: baz: mostly rewrite with some content from 24
776 | :
768 | :
777 | : o 30: baz:3->+3
769 | : o 30: baz:3->+3
778 | :/
770 | :/
779 +---o 27: baz:3+->3-
771 +---o 27: baz:3+->3-
780 | :
772 | :
781 o : 24: baz:3->3+
773 o : 24: baz:3->3+
782 :/
774 :/
783 o 20: baz:4
775 o 20: baz:4
784 |\
776 |\
785 ~ ~
777 ~ ~
786
778
787 check error cases
779 check error cases
788 $ hg up 24 --quiet
780 $ hg up 24 --quiet
789 $ hg log -r 'followlines()'
781 $ hg log -r 'followlines()'
790 hg: parse error: followlines takes at least 1 positional arguments
782 hg: parse error: followlines takes at least 1 positional arguments
791 [255]
783 [255]
792 $ hg log -r 'followlines(baz)'
784 $ hg log -r 'followlines(baz)'
793 hg: parse error: followlines requires a line range
785 hg: parse error: followlines requires a line range
794 [255]
786 [255]
795 $ hg log -r 'followlines(baz, 1)'
787 $ hg log -r 'followlines(baz, 1)'
796 hg: parse error: followlines expects a line range
788 hg: parse error: followlines expects a line range
797 [255]
789 [255]
798 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
790 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
799 hg: parse error: followlines expects exactly one revision
791 hg: parse error: followlines expects exactly one revision
800 [255]
792 [255]
801 $ hg log -r 'followlines("glob:*", 1:2)'
793 $ hg log -r 'followlines("glob:*", 1:2)'
802 hg: parse error: followlines expects exactly one file
794 hg: parse error: followlines expects exactly one file
803 [255]
795 [255]
804 $ hg log -r 'followlines(baz, 1:)'
796 $ hg log -r 'followlines(baz, 1:)'
805 hg: parse error: line range bounds must be integers
797 hg: parse error: line range bounds must be integers
806 [255]
798 [255]
807 $ hg log -r 'followlines(baz, :1)'
799 $ hg log -r 'followlines(baz, :1)'
808 hg: parse error: line range bounds must be integers
800 hg: parse error: line range bounds must be integers
809 [255]
801 [255]
810 $ hg log -r 'followlines(baz, x:4)'
802 $ hg log -r 'followlines(baz, x:4)'
811 hg: parse error: line range bounds must be integers
803 hg: parse error: line range bounds must be integers
812 [255]
804 [255]
813 $ hg log -r 'followlines(baz, 5:4)'
805 $ hg log -r 'followlines(baz, 5:4)'
814 hg: parse error: line range must be positive
806 hg: parse error: line range must be positive
815 [255]
807 [255]
816 $ hg log -r 'followlines(baz, 0:4)'
808 $ hg log -r 'followlines(baz, 0:4)'
817 hg: parse error: fromline must be strictly positive
809 hg: parse error: fromline must be strictly positive
818 [255]
810 [255]
819 $ hg log -r 'followlines(baz, 2:40)'
811 $ hg log -r 'followlines(baz, 2:40)'
820 abort: line range exceeds file size
812 abort: line range exceeds file size
821 [255]
813 [255]
822 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
814 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
823 hg: parse error at 43: syntax error in revset 'followlines(baz, 2:4, startrev=20, descend=[1])'
815 hg: parse error at 43: syntax error in revset 'followlines(baz, 2:4, startrev=20, descend=[1])'
824 [255]
816 [255]
825 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
817 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
826 hg: parse error: descend argument must be a boolean
818 hg: parse error: descend argument must be a boolean
827 [255]
819 [255]
828
820
829 Test empty annotate output
821 Test empty annotate output
830
822
831 $ printf '\0' > binary
823 $ printf '\0' > binary
832 $ touch empty
824 $ touch empty
833 $ hg ci -qAm 'add binary and empty files'
825 $ hg ci -qAm 'add binary and empty files'
834
826
835 $ hg annotate binary empty
827 $ hg annotate binary empty
836 binary: binary file
828 binary: binary file
837
829
838 $ hg annotate -Tjson binary empty
830 $ hg annotate -Tjson binary empty
839 [
831 [
840 {
832 {
841 "abspath": "binary",
833 "abspath": "binary",
842 "path": "binary"
834 "path": "binary"
843 },
835 },
844 {
836 {
845 "abspath": "empty",
837 "abspath": "empty",
846 "lines": [],
838 "lines": [],
847 "path": "empty"
839 "path": "empty"
848 }
840 }
849 ]
841 ]
850
842
851 Test annotate with whitespace options
843 Test annotate with whitespace options
852
844
853 $ cd ..
845 $ cd ..
854 $ hg init repo-ws
846 $ hg init repo-ws
855 $ cd repo-ws
847 $ cd repo-ws
856 $ cat > a <<EOF
848 $ cat > a <<EOF
857 > aa
849 > aa
858 >
850 >
859 > b b
851 > b b
860 > EOF
852 > EOF
861 $ hg ci -Am "adda"
853 $ hg ci -Am "adda"
862 adding a
854 adding a
863 $ sed 's/EOL$//g' > a <<EOF
855 $ sed 's/EOL$//g' > a <<EOF
864 > a a
856 > a a
865 >
857 >
866 > EOL
858 > EOL
867 > b b
859 > b b
868 > EOF
860 > EOF
869 $ hg ci -m "changea"
861 $ hg ci -m "changea"
870
862
871 Annotate with no option
863 Annotate with no option
872
864
873 $ hg annotate a
865 $ hg annotate a
874 1: a a
866 1: a a
875 0:
867 0:
876 1:
868 1:
877 1: b b
869 1: b b
878
870
879 Annotate with --ignore-space-change
871 Annotate with --ignore-space-change
880
872
881 $ hg annotate --ignore-space-change a
873 $ hg annotate --ignore-space-change a
882 1: a a
874 1: a a
883 1:
875 1:
884 0:
876 0:
885 0: b b
877 0: b b
886
878
887 Annotate with --ignore-all-space
879 Annotate with --ignore-all-space
888
880
889 $ hg annotate --ignore-all-space a
881 $ hg annotate --ignore-all-space a
890 0: a a
882 0: a a
891 0:
883 0:
892 1:
884 1:
893 0: b b
885 0: b b
894
886
895 Annotate with --ignore-blank-lines (similar to no options case)
887 Annotate with --ignore-blank-lines (similar to no options case)
896
888
897 $ hg annotate --ignore-blank-lines a
889 $ hg annotate --ignore-blank-lines a
898 1: a a
890 1: a a
899 0:
891 0:
900 1:
892 1:
901 1: b b
893 1: b b
902
894
903 $ cd ..
895 $ cd ..
904
896
905 Annotate with linkrev pointing to another branch
897 Annotate with linkrev pointing to another branch
906 ------------------------------------------------
898 ------------------------------------------------
907
899
908 create history with a filerev whose linkrev points to another branch
900 create history with a filerev whose linkrev points to another branch
909
901
910 $ hg init branchedlinkrev
902 $ hg init branchedlinkrev
911 $ cd branchedlinkrev
903 $ cd branchedlinkrev
912 $ echo A > a
904 $ echo A > a
913 $ hg commit -Am 'contentA'
905 $ hg commit -Am 'contentA'
914 adding a
906 adding a
915 $ echo B >> a
907 $ echo B >> a
916 $ hg commit -m 'contentB'
908 $ hg commit -m 'contentB'
917 $ hg up --rev 'desc(contentA)'
909 $ hg up --rev 'desc(contentA)'
918 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
910 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
919 $ echo unrelated > unrelated
911 $ echo unrelated > unrelated
920 $ hg commit -Am 'unrelated'
912 $ hg commit -Am 'unrelated'
921 adding unrelated
913 adding unrelated
922 created new head
914 created new head
923 $ hg graft -r 'desc(contentB)'
915 $ hg graft -r 'desc(contentB)'
924 grafting 1:fd27c222e3e6 "contentB"
916 grafting 1:fd27c222e3e6 "contentB"
925 $ echo C >> a
917 $ echo C >> a
926 $ hg commit -m 'contentC'
918 $ hg commit -m 'contentC'
927 $ echo W >> a
919 $ echo W >> a
928 $ hg log -G
920 $ hg log -G
929 @ changeset: 4:072f1e8df249
921 @ changeset: 4:072f1e8df249
930 | tag: tip
922 | tag: tip
931 | user: test
923 | user: test
932 | date: Thu Jan 01 00:00:00 1970 +0000
924 | date: Thu Jan 01 00:00:00 1970 +0000
933 | summary: contentC
925 | summary: contentC
934 |
926 |
935 o changeset: 3:ff38df03cc4b
927 o changeset: 3:ff38df03cc4b
936 | user: test
928 | user: test
937 | date: Thu Jan 01 00:00:00 1970 +0000
929 | date: Thu Jan 01 00:00:00 1970 +0000
938 | summary: contentB
930 | summary: contentB
939 |
931 |
940 o changeset: 2:62aaf3f6fc06
932 o changeset: 2:62aaf3f6fc06
941 | parent: 0:f0932f74827e
933 | parent: 0:f0932f74827e
942 | user: test
934 | user: test
943 | date: Thu Jan 01 00:00:00 1970 +0000
935 | date: Thu Jan 01 00:00:00 1970 +0000
944 | summary: unrelated
936 | summary: unrelated
945 |
937 |
946 | o changeset: 1:fd27c222e3e6
938 | o changeset: 1:fd27c222e3e6
947 |/ user: test
939 |/ user: test
948 | date: Thu Jan 01 00:00:00 1970 +0000
940 | date: Thu Jan 01 00:00:00 1970 +0000
949 | summary: contentB
941 | summary: contentB
950 |
942 |
951 o changeset: 0:f0932f74827e
943 o changeset: 0:f0932f74827e
952 user: test
944 user: test
953 date: Thu Jan 01 00:00:00 1970 +0000
945 date: Thu Jan 01 00:00:00 1970 +0000
954 summary: contentA
946 summary: contentA
955
947
956
948
957 Annotate should list ancestor of starting revision only
949 Annotate should list ancestor of starting revision only
958
950
959 $ hg annotate a
951 $ hg annotate a
960 0: A
952 0: A
961 3: B
953 3: B
962 4: C
954 4: C
963
955
964 $ hg annotate a -r 'wdir()'
956 $ hg annotate a -r 'wdir()'
965 0 : A
957 0 : A
966 3 : B
958 3 : B
967 4 : C
959 4 : C
968 4+: W
960 4+: W
969
961
970 Even when the starting revision is the linkrev-shadowed one:
962 Even when the starting revision is the linkrev-shadowed one:
971
963
972 $ hg annotate a -r 3
964 $ hg annotate a -r 3
973 0: A
965 0: A
974 3: B
966 3: B
975
967
976 $ cd ..
968 $ cd ..
977
969
978 Issue5360: Deleted chunk in p1 of a merge changeset
970 Issue5360: Deleted chunk in p1 of a merge changeset
979
971
980 $ hg init repo-5360
972 $ hg init repo-5360
981 $ cd repo-5360
973 $ cd repo-5360
982 $ echo 1 > a
974 $ echo 1 > a
983 $ hg commit -A a -m 1
975 $ hg commit -A a -m 1
984 $ echo 2 >> a
976 $ echo 2 >> a
985 $ hg commit -m 2
977 $ hg commit -m 2
986 $ echo a > a
978 $ echo a > a
987 $ hg commit -m a
979 $ hg commit -m a
988 $ hg update '.^' -q
980 $ hg update '.^' -q
989 $ echo 3 >> a
981 $ echo 3 >> a
990 $ hg commit -m 3 -q
982 $ hg commit -m 3 -q
991 $ hg merge 2 -q
983 $ hg merge 2 -q
992 $ cat > a << EOF
984 $ cat > a << EOF
993 > b
985 > b
994 > 1
986 > 1
995 > 2
987 > 2
996 > 3
988 > 3
997 > a
989 > a
998 > EOF
990 > EOF
999 $ hg resolve --mark -q
991 $ hg resolve --mark -q
1000 $ hg commit -m m
992 $ hg commit -m m
1001 $ hg annotate a
993 $ hg annotate a
1002 4: b
994 4: b
1003 0: 1
995 0: 1
1004 1: 2
996 1: 2
1005 3: 3
997 3: 3
1006 2: a
998 2: a
1007
999
1008 $ cd ..
1000 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now