Show More
@@ -1,533 +1,533 | |||
|
1 | 1 | #require repofncache |
|
2 | 2 | |
|
3 | 3 | An extension which will set fncache chunksize to 1 byte to make sure that logic |
|
4 | 4 | does not break |
|
5 | 5 | |
|
6 | 6 | $ cat > chunksize.py <<EOF |
|
7 | 7 | > from mercurial import store |
|
8 | 8 | > store.fncache_chunksize = 1 |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | $ cat >> $HGRCPATH <<EOF |
|
12 | 12 | > [extensions] |
|
13 | 13 | > chunksize = $TESTTMP/chunksize.py |
|
14 | 14 | > EOF |
|
15 | 15 | |
|
16 | 16 | Init repo1: |
|
17 | 17 | |
|
18 | 18 | $ hg init repo1 |
|
19 | 19 | $ cd repo1 |
|
20 | 20 | $ echo "some text" > a |
|
21 | 21 | $ hg add |
|
22 | 22 | adding a |
|
23 | 23 | $ hg ci -m first |
|
24 | 24 | $ cat .hg/store/fncache | sort |
|
25 | 25 | data/a.i |
|
26 | 26 | |
|
27 | 27 | Testing a.i/b: |
|
28 | 28 | |
|
29 | 29 | $ mkdir a.i |
|
30 | 30 | $ echo "some other text" > a.i/b |
|
31 | 31 | $ hg add |
|
32 | 32 | adding a.i/b |
|
33 | 33 | $ hg ci -m second |
|
34 | 34 | $ cat .hg/store/fncache | sort |
|
35 | 35 | data/a.i |
|
36 | 36 | data/a.i.hg/b.i |
|
37 | 37 | |
|
38 | 38 | Testing a.i.hg/c: |
|
39 | 39 | |
|
40 | 40 | $ mkdir a.i.hg |
|
41 | 41 | $ echo "yet another text" > a.i.hg/c |
|
42 | 42 | $ hg add |
|
43 | 43 | adding a.i.hg/c |
|
44 | 44 | $ hg ci -m third |
|
45 | 45 | $ cat .hg/store/fncache | sort |
|
46 | 46 | data/a.i |
|
47 | 47 | data/a.i.hg.hg/c.i |
|
48 | 48 | data/a.i.hg/b.i |
|
49 | 49 | |
|
50 | 50 | Testing verify: |
|
51 | 51 | |
|
52 | 52 | $ hg verify -q |
|
53 | 53 | |
|
54 | 54 | $ rm .hg/store/fncache |
|
55 | 55 | |
|
56 | 56 | $ hg verify |
|
57 | 57 | checking changesets |
|
58 | 58 | checking manifests |
|
59 | 59 | crosschecking files in changesets and manifests |
|
60 | 60 | checking files |
|
61 | 61 | warning: revlog 'data/a.i' not in fncache! |
|
62 | 62 | warning: revlog 'data/a.i.hg/c.i' not in fncache! |
|
63 | 63 | warning: revlog 'data/a.i/b.i' not in fncache! |
|
64 | 64 | checking dirstate |
|
65 | 65 | checked 3 changesets with 3 changes to 3 files |
|
66 | 66 | 3 warnings encountered! |
|
67 | 67 | hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
|
68 | 68 | |
|
69 | 69 | Follow the hint to make sure it works |
|
70 | 70 | |
|
71 | 71 | $ hg debugrebuildfncache |
|
72 | 72 | adding data/a.i |
|
73 | 73 | adding data/a.i.hg/c.i |
|
74 | 74 | adding data/a.i/b.i |
|
75 | 75 | 3 items added, 0 removed from fncache |
|
76 | 76 | |
|
77 | 77 | $ hg verify -q |
|
78 | 78 | |
|
79 | 79 | $ cd .. |
|
80 | 80 | |
|
81 | 81 | Non store repo: |
|
82 | 82 | |
|
83 | 83 | $ hg --config format.usestore=False init foo |
|
84 | 84 | $ cd foo |
|
85 | 85 | $ mkdir tst.d |
|
86 | 86 | $ echo foo > tst.d/foo |
|
87 | 87 | $ hg ci -Amfoo |
|
88 | 88 | adding tst.d/foo |
|
89 | 89 | $ find .hg | sort |
|
90 | 90 | .hg |
|
91 | 91 | .hg/00changelog.i |
|
92 | 92 | .hg/00manifest.i |
|
93 | 93 | .hg/cache |
|
94 | 94 | .hg/cache/branch2-served |
|
95 | 95 | .hg/cache/rbc-names-v1 |
|
96 | 96 | .hg/cache/rbc-revs-v1 |
|
97 | 97 | .hg/data |
|
98 | 98 | .hg/data/tst.d.hg |
|
99 | 99 | .hg/data/tst.d.hg/foo.i |
|
100 | 100 | .hg/dirstate |
|
101 | 101 | .hg/fsmonitor.state (fsmonitor !) |
|
102 | 102 | .hg/last-message.txt |
|
103 | 103 | .hg/phaseroots |
|
104 | 104 | .hg/requires |
|
105 | 105 | .hg/undo |
|
106 | 106 | .hg/undo.backupfiles |
|
107 | 107 | .hg/undo.bookmarks |
|
108 | 108 | .hg/undo.branch |
|
109 | 109 | .hg/undo.desc |
|
110 | 110 | .hg/undo.phaseroots |
|
111 | 111 | .hg/wcache |
|
112 | 112 | .hg/wcache/checkisexec (execbit !) |
|
113 | 113 | .hg/wcache/checklink (symlink !) |
|
114 | 114 | .hg/wcache/checklink-target (symlink !) |
|
115 | 115 | .hg/wcache/manifestfulltextcache (reporevlogstore !) |
|
116 | 116 | $ cd .. |
|
117 | 117 | |
|
118 | 118 | Non fncache repo: |
|
119 | 119 | |
|
120 | 120 | $ hg --config format.usefncache=False init bar |
|
121 | 121 | $ cd bar |
|
122 | 122 | $ mkdir tst.d |
|
123 | 123 | $ echo foo > tst.d/Foo |
|
124 | 124 | $ hg ci -Amfoo |
|
125 | 125 | adding tst.d/Foo |
|
126 | 126 | $ find .hg | sort |
|
127 | 127 | .hg |
|
128 | 128 | .hg/00changelog.i |
|
129 | 129 | .hg/cache |
|
130 | 130 | .hg/cache/branch2-served |
|
131 | 131 | .hg/cache/rbc-names-v1 |
|
132 | 132 | .hg/cache/rbc-revs-v1 |
|
133 | 133 | .hg/dirstate |
|
134 | 134 | .hg/fsmonitor.state (fsmonitor !) |
|
135 | 135 | .hg/last-message.txt |
|
136 | 136 | .hg/requires |
|
137 | 137 | .hg/store |
|
138 | 138 | .hg/store/00changelog.i |
|
139 | 139 | .hg/store/00manifest.i |
|
140 | 140 | .hg/store/data |
|
141 | 141 | .hg/store/data/tst.d.hg |
|
142 | 142 | .hg/store/data/tst.d.hg/_foo.i |
|
143 | 143 | .hg/store/phaseroots |
|
144 | 144 | .hg/store/requires |
|
145 | 145 | .hg/store/undo |
|
146 | 146 | .hg/store/undo.backupfiles |
|
147 | 147 | .hg/store/undo.phaseroots |
|
148 | 148 | .hg/undo.bookmarks |
|
149 | 149 | .hg/undo.branch |
|
150 | 150 | .hg/undo.desc |
|
151 | 151 | .hg/wcache |
|
152 | 152 | .hg/wcache/checkisexec (execbit !) |
|
153 | 153 | .hg/wcache/checklink (symlink !) |
|
154 | 154 | .hg/wcache/checklink-target (symlink !) |
|
155 | 155 | .hg/wcache/manifestfulltextcache (reporevlogstore !) |
|
156 | 156 | $ cd .. |
|
157 | 157 | |
|
158 | 158 | Encoding of reserved / long paths in the store |
|
159 | 159 | |
|
160 | 160 | $ hg init r2 |
|
161 | 161 | $ cd r2 |
|
162 | 162 | $ cat <<EOF > .hg/hgrc |
|
163 | 163 | > [ui] |
|
164 | 164 | > portablefilenames = ignore |
|
165 | 165 | > EOF |
|
166 | 166 | |
|
167 | 167 | $ hg import -q --bypass - <<EOF |
|
168 | 168 | > # HG changeset patch |
|
169 | 169 | > # User test |
|
170 | 170 | > # Date 0 0 |
|
171 | 171 | > # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7 |
|
172 | 172 | > # Parent 0000000000000000000000000000000000000000 |
|
173 | 173 | > 1 |
|
174 | 174 | > |
|
175 | 175 | > diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz |
|
176 | 176 | > new file mode 100644 |
|
177 | 177 | > --- /dev/null |
|
178 | 178 | > +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz |
|
179 | 179 | > @@ -0,0 +1,1 @@ |
|
180 | 180 | > +foo |
|
181 | 181 | > diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT |
|
182 | 182 | > new file mode 100644 |
|
183 | 183 | > --- /dev/null |
|
184 | 184 | > +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT |
|
185 | 185 | > @@ -0,0 +1,1 @@ |
|
186 | 186 | > +foo |
|
187 | 187 | > diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt |
|
188 | 188 | > new file mode 100644 |
|
189 | 189 | > --- /dev/null |
|
190 | 190 | > +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt |
|
191 | 191 | > @@ -0,0 +1,1 @@ |
|
192 | 192 | > +foo |
|
193 | 193 | > diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c |
|
194 | 194 | > new file mode 100644 |
|
195 | 195 | > --- /dev/null |
|
196 | 196 | > +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c |
|
197 | 197 | > @@ -0,0 +1,1 @@ |
|
198 | 198 | > +foo |
|
199 | 199 | > diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider |
|
200 | 200 | > new file mode 100644 |
|
201 | 201 | > --- /dev/null |
|
202 | 202 | > +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider |
|
203 | 203 | > @@ -0,0 +1,1 @@ |
|
204 | 204 | > +foo |
|
205 | 205 | > EOF |
|
206 | 206 | |
|
207 | 207 | $ find .hg/store -name *.i | sort |
|
208 | 208 | .hg/store/00changelog.i |
|
209 | 209 | .hg/store/00manifest.i |
|
210 | 210 | .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i |
|
211 | 211 | .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i |
|
212 | 212 | .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i |
|
213 | 213 | .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i |
|
214 | 214 | .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i |
|
215 | 215 | |
|
216 | 216 | $ cd .. |
|
217 | 217 | |
|
218 | 218 | Aborting lock does not prevent fncache writes |
|
219 | 219 | |
|
220 | 220 | $ cat > exceptionext.py <<EOF |
|
221 | 221 | > import os |
|
222 | 222 | > from mercurial import commands, error, extensions |
|
223 | 223 | > |
|
224 | 224 | > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs): |
|
225 | 225 | > def releasewrap(): |
|
226 | 226 | > l.held = False # ensure __del__ is a noop |
|
227 | 227 | > raise error.Abort(b"forced lock failure") |
|
228 | 228 | > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs) |
|
229 | 229 | > return l |
|
230 | 230 | > |
|
231 | 231 | > def reposetup(ui, repo): |
|
232 | 232 | > extensions.wrapfunction(repo, '_lock', lockexception) |
|
233 | 233 | > |
|
234 | 234 | > cmdtable = {} |
|
235 | 235 | > |
|
236 | 236 | > # wrap "commit" command to prevent wlock from being '__del__()'-ed |
|
237 | 237 | > # at the end of dispatching (for intentional "forced lcok failure") |
|
238 | 238 | > def commitwrap(orig, ui, repo, *pats, **opts): |
|
239 | 239 | > repo = repo.unfiltered() # to use replaced repo._lock certainly |
|
240 | 240 | > wlock = repo.wlock() |
|
241 | 241 | > try: |
|
242 | 242 | > return orig(ui, repo, *pats, **opts) |
|
243 | 243 | > finally: |
|
244 | 244 | > # multiple 'relase()' is needed for complete releasing wlock, |
|
245 | 245 | > # because "forced" abort at last releasing store lock |
|
246 | 246 | > # prevents wlock from being released at same 'lockmod.release()' |
|
247 | 247 | > for i in range(wlock.held): |
|
248 | 248 | > wlock.release() |
|
249 | 249 | > |
|
250 | 250 | > def extsetup(ui): |
|
251 | 251 | > extensions.wrapcommand(commands.table, b"commit", commitwrap) |
|
252 | 252 | > EOF |
|
253 | 253 | $ extpath=`pwd`/exceptionext.py |
|
254 | 254 | $ hg init fncachetxn |
|
255 | 255 | $ cd fncachetxn |
|
256 | 256 | $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc |
|
257 | 257 | $ touch y |
|
258 | 258 | $ hg ci -qAm y |
|
259 | 259 | abort: forced lock failure |
|
260 | 260 | [255] |
|
261 | 261 | $ cat .hg/store/fncache |
|
262 | 262 | data/y.i |
|
263 | 263 | |
|
264 | 264 | Aborting transaction prevents fncache change |
|
265 | 265 | |
|
266 | 266 | $ cat > ../exceptionext.py <<EOF |
|
267 | 267 | > import os |
|
268 | 268 | > from mercurial import commands, error, extensions, localrepo |
|
269 | 269 | > |
|
270 | 270 | > def wrapper(orig, self, *args, **kwargs): |
|
271 | 271 | > tr = orig(self, *args, **kwargs) |
|
272 | 272 | > def fail(tr): |
|
273 | 273 | > raise error.Abort(b"forced transaction failure") |
|
274 | 274 | > # zzz prefix to ensure it sorted after store.write |
|
275 | 275 | > tr.addfinalize(b'zzz-forcefails', fail) |
|
276 | 276 | > return tr |
|
277 | 277 | > |
|
278 | 278 | > def uisetup(ui): |
|
279 | 279 | > extensions.wrapfunction( |
|
280 | 280 | > localrepo.localrepository, b'transaction', wrapper) |
|
281 | 281 | > |
|
282 | 282 | > cmdtable = {} |
|
283 | 283 | > |
|
284 | 284 | > EOF |
|
285 | 285 | |
|
286 | 286 | Clean cached version |
|
287 | 287 | $ rm -f "${extpath}c" |
|
288 | 288 | $ rm -Rf "`dirname $extpath`/__pycache__" |
|
289 | 289 | |
|
290 | 290 | $ touch z |
|
291 | 291 | $ hg ci -qAm z |
|
292 | 292 | transaction abort! |
|
293 | 293 | rollback completed |
|
294 | 294 | abort: forced transaction failure |
|
295 | 295 | [255] |
|
296 | 296 | $ cat .hg/store/fncache |
|
297 | 297 | data/y.i |
|
298 | 298 | |
|
299 | 299 | Aborted transactions can be recovered later |
|
300 | 300 | |
|
301 | 301 | $ cat > ../exceptionext.py <<EOF |
|
302 | 302 | > import os |
|
303 | 303 | > import signal |
|
304 | 304 | > from mercurial import ( |
|
305 | 305 | > commands, |
|
306 | 306 | > error, |
|
307 | 307 | > extensions, |
|
308 | 308 | > localrepo, |
|
309 | 309 | > transaction, |
|
310 | 310 | > ) |
|
311 | 311 | > |
|
312 | 312 | > def trwrapper(orig, self, *args, **kwargs): |
|
313 | 313 | > tr = orig(self, *args, **kwargs) |
|
314 | 314 | > def fail(tr): |
|
315 | 315 | > os.kill(os.getpid(), signal.SIGKILL) |
|
316 | 316 | > # zzz prefix to ensure it sorted after store.write |
|
317 | 317 | > tr.addfinalize(b'zzz-forcefails', fail) |
|
318 | 318 | > return tr |
|
319 | 319 | > |
|
320 | 320 | > def uisetup(ui): |
|
321 | 321 | > extensions.wrapfunction(localrepo.localrepository, 'transaction', |
|
322 | 322 | > trwrapper) |
|
323 | 323 | > |
|
324 | 324 | > cmdtable = {} |
|
325 | 325 | > |
|
326 | 326 | > EOF |
|
327 | 327 | |
|
328 | 328 | Clean cached versions |
|
329 | 329 | $ rm -f "${extpath}c" |
|
330 | 330 | $ rm -Rf "`dirname $extpath`/__pycache__" |
|
331 | 331 | |
|
332 | 332 | $ hg up -q 1 |
|
333 | 333 | $ touch z |
|
334 | 334 | # Cannot rely on the return code value as chg use a different one. |
|
335 | 335 | # So we use a `|| echo` trick |
|
336 | 336 | # XXX-CHG fixing chg behavior would be nice here. |
|
337 | 337 | $ hg ci -qAm z || echo "He's Dead, Jim." 2>/dev/null |
|
338 | Killed (?) | |
|
338 | *Killed* (glob) (?) | |
|
339 | 339 | He's Dead, Jim. |
|
340 | 340 | $ cat .hg/store/fncache | sort |
|
341 | 341 | data/y.i |
|
342 | 342 | data/z.i |
|
343 | 343 | $ hg recover --verify |
|
344 | 344 | rolling back interrupted transaction |
|
345 | 345 | checking changesets |
|
346 | 346 | checking manifests |
|
347 | 347 | crosschecking files in changesets and manifests |
|
348 | 348 | checking files |
|
349 | 349 | checking dirstate |
|
350 | 350 | checked 1 changesets with 1 changes to 1 files |
|
351 | 351 | $ cat .hg/store/fncache |
|
352 | 352 | data/y.i |
|
353 | 353 | |
|
354 | 354 | $ cd .. |
|
355 | 355 | |
|
356 | 356 | debugrebuildfncache does nothing unless repo has fncache requirement |
|
357 | 357 | |
|
358 | 358 | $ hg --config format.usefncache=false init nofncache |
|
359 | 359 | $ cd nofncache |
|
360 | 360 | $ hg debugrebuildfncache |
|
361 | 361 | (not rebuilding fncache because repository does not support fncache) |
|
362 | 362 | |
|
363 | 363 | $ cd .. |
|
364 | 364 | |
|
365 | 365 | debugrebuildfncache works on empty repository |
|
366 | 366 | |
|
367 | 367 | $ hg init empty |
|
368 | 368 | $ cd empty |
|
369 | 369 | $ hg debugrebuildfncache |
|
370 | 370 | fncache already up to date |
|
371 | 371 | $ cd .. |
|
372 | 372 | |
|
373 | 373 | debugrebuildfncache on an up to date repository no-ops |
|
374 | 374 | |
|
375 | 375 | $ hg init repo |
|
376 | 376 | $ cd repo |
|
377 | 377 | $ echo initial > foo |
|
378 | 378 | $ echo initial > .bar |
|
379 | 379 | $ hg commit -A -m initial |
|
380 | 380 | adding .bar |
|
381 | 381 | adding foo |
|
382 | 382 | |
|
383 | 383 | $ cat .hg/store/fncache | sort |
|
384 | 384 | data/.bar.i |
|
385 | 385 | data/foo.i |
|
386 | 386 | |
|
387 | 387 | $ hg debugrebuildfncache |
|
388 | 388 | fncache already up to date |
|
389 | 389 | |
|
390 | 390 | debugrebuildfncache restores deleted fncache file |
|
391 | 391 | |
|
392 | 392 | $ rm -f .hg/store/fncache |
|
393 | 393 | $ hg debugrebuildfncache |
|
394 | 394 | adding data/.bar.i |
|
395 | 395 | adding data/foo.i |
|
396 | 396 | 2 items added, 0 removed from fncache |
|
397 | 397 | |
|
398 | 398 | $ cat .hg/store/fncache | sort |
|
399 | 399 | data/.bar.i |
|
400 | 400 | data/foo.i |
|
401 | 401 | |
|
402 | 402 | Rebuild after rebuild should no-op |
|
403 | 403 | |
|
404 | 404 | $ hg debugrebuildfncache |
|
405 | 405 | fncache already up to date |
|
406 | 406 | |
|
407 | 407 | A single missing file should get restored, an extra file should be removed |
|
408 | 408 | |
|
409 | 409 | $ cat > .hg/store/fncache << EOF |
|
410 | 410 | > data/foo.i |
|
411 | 411 | > data/bad-entry.i |
|
412 | 412 | > EOF |
|
413 | 413 | |
|
414 | 414 | $ hg debugrebuildfncache |
|
415 | 415 | removing data/bad-entry.i |
|
416 | 416 | adding data/.bar.i |
|
417 | 417 | 1 items added, 1 removed from fncache |
|
418 | 418 | |
|
419 | 419 | $ cat .hg/store/fncache | sort |
|
420 | 420 | data/.bar.i |
|
421 | 421 | data/foo.i |
|
422 | 422 | |
|
423 | 423 | debugrebuildfncache recovers from truncated line in fncache |
|
424 | 424 | |
|
425 | 425 | $ printf a > .hg/store/fncache |
|
426 | 426 | $ hg debugrebuildfncache |
|
427 | 427 | fncache does not ends with a newline |
|
428 | 428 | adding data/.bar.i |
|
429 | 429 | adding data/foo.i |
|
430 | 430 | 2 items added, 0 removed from fncache |
|
431 | 431 | |
|
432 | 432 | $ cat .hg/store/fncache | sort |
|
433 | 433 | data/.bar.i |
|
434 | 434 | data/foo.i |
|
435 | 435 | |
|
436 | 436 | $ cd .. |
|
437 | 437 | |
|
438 | 438 | Try a simple variation without dotencode to ensure fncache is ignorant of encoding |
|
439 | 439 | |
|
440 | 440 | $ hg --config format.dotencode=false init nodotencode |
|
441 | 441 | $ cd nodotencode |
|
442 | 442 | $ echo initial > foo |
|
443 | 443 | $ echo initial > .bar |
|
444 | 444 | $ hg commit -A -m initial |
|
445 | 445 | adding .bar |
|
446 | 446 | adding foo |
|
447 | 447 | |
|
448 | 448 | $ cat .hg/store/fncache | sort |
|
449 | 449 | data/.bar.i |
|
450 | 450 | data/foo.i |
|
451 | 451 | |
|
452 | 452 | $ rm .hg/store/fncache |
|
453 | 453 | $ hg debugrebuildfncache |
|
454 | 454 | adding data/.bar.i |
|
455 | 455 | adding data/foo.i |
|
456 | 456 | 2 items added, 0 removed from fncache |
|
457 | 457 | |
|
458 | 458 | $ cat .hg/store/fncache | sort |
|
459 | 459 | data/.bar.i |
|
460 | 460 | data/foo.i |
|
461 | 461 | |
|
462 | 462 | $ cd .. |
|
463 | 463 | |
|
464 | 464 | In repositories that have accumulated a large number of files over time, the |
|
465 | 465 | fncache file is going to be large. If we possibly can avoid loading it, so much the better. |
|
466 | 466 | The cache should not loaded when committing changes to existing files, or when unbundling |
|
467 | 467 | changesets that only contain changes to existing files: |
|
468 | 468 | |
|
469 | 469 | $ cat > fncacheloadwarn.py << EOF |
|
470 | 470 | > from mercurial import extensions, localrepo |
|
471 | 471 | > |
|
472 | 472 | > def extsetup(ui): |
|
473 | 473 | > def wrapstore(orig, requirements, *args): |
|
474 | 474 | > store = orig(requirements, *args) |
|
475 | 475 | > if b'store' in requirements and b'fncache' in requirements: |
|
476 | 476 | > instrumentfncachestore(store, ui) |
|
477 | 477 | > return store |
|
478 | 478 | > extensions.wrapfunction(localrepo, 'makestore', wrapstore) |
|
479 | 479 | > |
|
480 | 480 | > def instrumentfncachestore(fncachestore, ui): |
|
481 | 481 | > class instrumentedfncache(type(fncachestore.fncache)): |
|
482 | 482 | > def _load(self): |
|
483 | 483 | > ui.warn(b'fncache load triggered!\n') |
|
484 | 484 | > super(instrumentedfncache, self)._load() |
|
485 | 485 | > fncachestore.fncache.__class__ = instrumentedfncache |
|
486 | 486 | > EOF |
|
487 | 487 | |
|
488 | 488 | $ fncachextpath=`pwd`/fncacheloadwarn.py |
|
489 | 489 | $ hg init nofncacheload |
|
490 | 490 | $ cd nofncacheload |
|
491 | 491 | $ printf "[extensions]\nfncacheloadwarn=$fncachextpath\n" >> .hg/hgrc |
|
492 | 492 | |
|
493 | 493 | A new file should trigger a load, as we'd want to update the fncache set in that case: |
|
494 | 494 | |
|
495 | 495 | $ touch foo |
|
496 | 496 | $ hg ci -qAm foo |
|
497 | 497 | fncache load triggered! |
|
498 | 498 | |
|
499 | 499 | But modifying that file should not: |
|
500 | 500 | |
|
501 | 501 | $ echo bar >> foo |
|
502 | 502 | $ hg ci -qm foo |
|
503 | 503 | |
|
504 | 504 | If a transaction has been aborted, the zero-size truncated index file will |
|
505 | 505 | not prevent the fncache from being loaded; rather than actually abort |
|
506 | 506 | a transaction, we simulate the situation by creating a zero-size index file: |
|
507 | 507 | |
|
508 | 508 | $ touch .hg/store/data/bar.i |
|
509 | 509 | $ touch bar |
|
510 | 510 | $ hg ci -qAm bar |
|
511 | 511 | fncache load triggered! |
|
512 | 512 | |
|
513 | 513 | Unbundling should follow the same rules; existing files should not cause a load: |
|
514 | 514 | |
|
515 | 515 | (loading during the clone is expected) |
|
516 | 516 | $ hg clone -q . tobundle |
|
517 | 517 | fncache load triggered! |
|
518 | 518 | fncache load triggered! |
|
519 | 519 | |
|
520 | 520 | $ echo 'new line' > tobundle/bar |
|
521 | 521 | $ hg -R tobundle ci -qm bar |
|
522 | 522 | $ hg -R tobundle bundle -q barupdated.hg |
|
523 | 523 | $ hg unbundle -q barupdated.hg |
|
524 | 524 | |
|
525 | 525 | but adding new files should: |
|
526 | 526 | |
|
527 | 527 | $ touch tobundle/newfile |
|
528 | 528 | $ hg -R tobundle ci -qAm newfile |
|
529 | 529 | $ hg -R tobundle bundle -q newfile.hg |
|
530 | 530 | $ hg unbundle -q newfile.hg |
|
531 | 531 | fncache load triggered! |
|
532 | 532 | |
|
533 | 533 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now