Debian Codegraph @

tests/test-fastannotate-renames.t

raw
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
3 > fastannotate=
4 > [fastannotate]
5 > mainbranch=main
6 > EOF
7
8 $ hg init repo
9 $ cd repo
10
11 add or rename files on top of the master branch
12
13 $ echo a1 > a
14 $ echo b1 > b
15 $ hg commit -qAm 1
16 $ hg bookmark -i main
17 $ hg fastannotate --debug -nf b
18 fastannotate: b: 1 new changesets in the main branch
19 0 b: b1
20 $ hg fastannotate --debug -nf a
21 fastannotate: a: 1 new changesets in the main branch
22 0 a: a1
23 $ echo a2 >> a
24 $ cat > b << EOF
25 > b0
26 > b1
27 > EOF
28 $ hg mv a t
29 $ hg mv b a
30 $ hg mv t b
31 $ hg commit -m 'swap names'
32
33 existing linelogs are not helpful with such renames in side branches
34
35 $ hg fastannotate --debug -nf a
36 fastannotate: a: linelog cannot help in annotating this revision
37 1 a: b0
38 0 b: b1
39 $ hg fastannotate --debug -nf b
40 fastannotate: b: linelog cannot help in annotating this revision
41 0 a: a1
42 1 b: a2
43
44 move main branch forward, rebuild should happen
45
46 $ hg bookmark -i main -r . -q
47 $ hg fastannotate --debug -nf b
48 fastannotate: b: cache broken and deleted
49 fastannotate: b: 2 new changesets in the main branch
50 0 a: a1
51 1 b: a2
52 $ hg fastannotate --debug -nf b
53 fastannotate: b: using fast path (resolved fctx: True)
54 0 a: a1
55 1 b: a2
56
57 for rev 0, the existing linelog is still useful for a, but not for b
58
59 $ hg fastannotate --debug -nf a -r 0
60 fastannotate: a: using fast path (resolved fctx: True)
61 0 a: a1
62 $ hg fastannotate --debug -nf b -r 0
63 fastannotate: b: linelog cannot help in annotating this revision
64 0 b: b1
65
66 a rebuild can also be triggered if "the main branch last time" mismatches
67
68 $ echo a3 >> a
69 $ hg commit -m a3
70 $ cat >> b << EOF
71 > b3
72 > b4
73 > EOF
74 $ hg commit -m b4
75 $ hg bookmark -i main -q
76 $ hg fastannotate --debug -nf a
77 fastannotate: a: cache broken and deleted
78 fastannotate: a: 3 new changesets in the main branch
79 1 a: b0
80 0 b: b1
81 2 a: a3
82 $ hg fastannotate --debug -nf a
83 fastannotate: a: using fast path (resolved fctx: True)
84 1 a: b0
85 0 b: b1
86 2 a: a3
87
88 linelog can be updated without being helpful
89
90 $ hg mv a t
91 $ hg mv b a
92 $ hg mv t b
93 $ hg commit -m 'swap names again'
94 $ hg fastannotate --debug -nf b
95 fastannotate: b: 1 new changesets in the main branch
96 1 a: b0
97 0 b: b1
98 2 a: a3
99 $ hg fastannotate --debug -nf b
100 fastannotate: b: linelog cannot help in annotating this revision
101 1 a: b0
102 0 b: b1
103 2 a: a3
104
105 move main branch forward again, rebuilds are one-time
106
107 $ hg bookmark -i main -q
108 $ hg fastannotate --debug -nf a
109 fastannotate: a: cache broken and deleted
110 fastannotate: a: 4 new changesets in the main branch
111 0 a: a1
112 1 b: a2
113 3 b: b3
114 3 b: b4
115 $ hg fastannotate --debug -nf b
116 fastannotate: b: cache broken and deleted
117 fastannotate: b: 4 new changesets in the main branch
118 1 a: b0
119 0 b: b1
120 2 a: a3
121 $ hg fastannotate --debug -nf a
122 fastannotate: a: using fast path (resolved fctx: True)
123 0 a: a1
124 1 b: a2
125 3 b: b3
126 3 b: b4
127 $ hg fastannotate --debug -nf b
128 fastannotate: b: using fast path (resolved fctx: True)
129 1 a: b0
130 0 b: b1
131 2 a: a3
132
133 list changeset hashes to improve readability
134
135 $ hg log -T '{rev}:{node}\n'
136 4:980e1ab8c516350172928fba95b49ede3b643dca
137 3:14e123fedad9f491f5dde0beca2a767625a0a93a
138 2:96495c41e4c12218766f78cdf244e768d7718b0f
139 1:35c2b781234c994896aba36bd3245d3104e023df
140 0:653e95416ebb5dbcc25bbc7f75568c9e01f7bd2f
141
142 annotate a revision not in the linelog. linelog cannot be used, but does not get rebuilt either
143
144 $ hg fastannotate --debug -nf a -r 96495c41e4c12218766f78cdf244e768d7718b0f
145 fastannotate: a: linelog cannot help in annotating this revision
146 1 a: b0
147 0 b: b1
148 2 a: a3
149 $ hg fastannotate --debug -nf a -r 2
150 fastannotate: a: linelog cannot help in annotating this revision
151 1 a: b0
152 0 b: b1
153 2 a: a3
154 $ hg fastannotate --debug -nf a -r .
155 fastannotate: a: using fast path (resolved fctx: True)
156 0 a: a1
157 1 b: a2
158 3 b: b3
159 3 b: b4
160
161 annotate an ancient revision where the path matches. linelog can be used
162
163 $ hg fastannotate --debug -nf a -r 0
164 fastannotate: a: using fast path (resolved fctx: True)
165 0 a: a1
166 $ hg fastannotate --debug -nf a -r 653e95416ebb5dbcc25bbc7f75568c9e01f7bd2f
167 fastannotate: a: using fast path (resolved fctx: False)
168 0 a: a1