Debian Codegraph @

tests/test-fastannotate.t

raw
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
3 > fastannotate=
4 > EOF
5
6 $ hg init repo
7 $ cd repo
8
9 a simple merge case
10
11 $ echo 1 > a
12 $ hg commit -qAm 'append 1'
13 $ echo 2 >> a
14 $ hg commit -m 'append 2'
15 $ echo 3 >> a
16 $ hg commit -m 'append 3'
17 $ hg up 1 -q
18 $ cat > a << EOF
19 > 0
20 > 1
21 > 2
22 > EOF
23 $ hg commit -qm 'insert 0'
24 $ hg merge 2 -q
25 $ echo 4 >> a
26 $ hg commit -m merge
27 $ hg log -G -T '{rev}: {desc}'
28 @ 4: merge
29 |\
30 | o 3: insert 0
31 | |
32 o | 2: append 3
33 |/
34 o 1: append 2
35 |
36 o 0: append 1
37
38 $ hg fastannotate a
39 3: 0
40 0: 1
41 1: 2
42 2: 3
43 4: 4
44 $ hg fastannotate -r 0 a
45 0: 1
46 $ hg fastannotate -r 1 a
47 0: 1
48 1: 2
49 $ hg fastannotate -udnclf a
50 test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
51 test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
52 test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
53 test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
54 test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
55 $ hg fastannotate --linear a
56 3: 0
57 0: 1
58 1: 2
59 4: 3
60 4: 4
61
62 incrementally updating
63
64 $ hg fastannotate -r 0 a --debug
65 fastannotate: a: using fast path (resolved fctx: True)
66 0: 1
67 $ hg fastannotate -r 0 a --debug --rebuild
68 fastannotate: a: 1 new changesets in the main branch
69 0: 1
70 $ hg fastannotate -r 1 a --debug
71 fastannotate: a: 1 new changesets in the main branch
72 0: 1
73 1: 2
74 $ hg fastannotate -r 3 a --debug
75 fastannotate: a: 1 new changesets in the main branch
76 3: 0
77 0: 1
78 1: 2
79 $ hg fastannotate -r 4 a --debug
80 fastannotate: a: 1 new changesets in the main branch
81 3: 0
82 0: 1
83 1: 2
84 2: 3
85 4: 4
86 $ hg fastannotate -r 1 a --debug
87 fastannotate: a: using fast path (resolved fctx: True)
88 0: 1
89 1: 2
90
91 rebuild happens automatically if unable to update
92
93 $ hg fastannotate -r 2 a --debug
94 fastannotate: a: cache broken and deleted
95 fastannotate: a: 3 new changesets in the main branch
96 0: 1
97 1: 2
98 2: 3
99
100 config option "fastannotate.mainbranch"
101
102 $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
103 fastannotate: a: 4 new changesets in the main branch
104 0: 1
105 1: 2
106 $ hg fastannotate -r 4 a --debug
107 fastannotate: a: using fast path (resolved fctx: True)
108 3: 0
109 0: 1
110 1: 2
111 2: 3
112 4: 4
113
114 config option "fastannotate.modes"
115
116 $ hg annotate -r 1 --debug a
117 0: 1
118 1: 2
119 $ hg annotate --config fastannotate.modes=fctx -r 1 --debug a
120 fastannotate: a: using fast path (resolved fctx: False)
121 0: 1
122 1: 2
123 $ hg fastannotate --config fastannotate.modes=fctx -h -q
124 hg: unknown command 'fastannotate'
125 (did you mean *) (glob)
126 [10]
127
128 rename
129
130 $ hg mv a b
131 $ cat > b << EOF
132 > 0
133 > 11
134 > 3
135 > 44
136 > EOF
137 $ hg commit -m b -q
138 $ hg fastannotate -ncf --long-hash b
139 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
140 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
141 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
142 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
143 $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
144 0: 1
145 1: 2
146 2: 3
147
148 fastannotate --deleted
149
150 $ hg fastannotate --deleted -nf b
151 3 a: 0
152 5 b: 11
153 0 a: -1
154 1 a: -2
155 2 a: 3
156 5 b: 44
157 4 a: -4
158 $ hg fastannotate --deleted -r 3 -nf a
159 3 a: 0
160 0 a: 1
161 1 a: 2
162
163 file and directories with ".l", ".m" suffixes
164
165 $ cd ..
166 $ hg init repo2
167 $ cd repo2
168
169 $ mkdir a.l b.m c.lock a.l.hg b.hg
170 $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
171 > echo $i > $i
172 > done
173 $ hg add . -q
174 $ hg commit -m init
175 $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
176 0: a
177 0: a.l.hg/a
178 0: a.l/a
179 0: b
180 0: b.hg/a
181 0: b.m/a
182 0: c
183 0: c.lock/a
184 0: d
185 0: d.l
186 0: d.m
187
188 empty file
189
190 $ touch empty
191 $ hg commit -A empty -m empty
192 $ hg fastannotate empty
193
194 json format
195
196 $ hg fastannotate -Tjson -cludn b a empty
197 [
198 {
199 "date": [0.0, 0],
200 "line": "a\n",
201 "line_number": 1,
202 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
203 "rev": 0,
204 "user": "test"
205 },
206 {
207 "date": [0.0, 0],
208 "line": "b\n",
209 "line_number": 1,
210 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
211 "rev": 0,
212 "user": "test"
213 }
214 ]
215
216 $ hg fastannotate -Tjson -cludn empty
217 [
218 ]
219 $ hg fastannotate -Tjson --no-content -n a
220 [
221 {
222 "rev": 0
223 }
224 ]
225
226 working copy
227
228 $ echo a >> a
229 $ hg fastannotate -r 'wdir()' a
230 abort: cannot update linelog to wdir()
231 (set fastannotate.mainbranch)
232 [255]
233 $ cat >> $HGRCPATH << EOF
234 > [fastannotate]
235 > mainbranch = .
236 > EOF
237 $ hg fastannotate -r 'wdir()' a
238 0 : a
239 1+: a
240 $ hg fastannotate -cludn -r 'wdir()' a
241 test 0 1fd620b16252 Thu Jan 01 00:00:00 1970 +0000:1: a
242 test 1 720582f5bdb6+ *:2: a (glob)
243 $ hg fastannotate -cludn -r 'wdir()' -Tjson a
244 [
245 {
246 "date": [0.0, 0],
247 "line": "a\n",
248 "line_number": 1,
249 "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21",
250 "rev": 0,
251 "user": "test"
252 },
253 {
254 "date": [*, 0], (glob)
255 "line": "a\n",
256 "line_number": 2,
257 "node": null,
258 "rev": null,
259 "user": "test"
260 }
261 ]