Show More
@@ -146,6 +146,7 class revbranchcache: | |||
|
146 | 146 | self._names = [] # branch names in local encoding with static index |
|
147 | 147 | self._rbcrevs = rbcrevs(bytearray()) |
|
148 | 148 | self._rbcsnameslen = 0 # length of names read at _rbcsnameslen |
|
149 | self._force_overwrite = False | |
|
149 | 150 | v1_fallback = False |
|
150 | 151 | try: |
|
151 | 152 | try: |
@@ -157,6 +158,7 class revbranchcache: | |||
|
157 | 158 | # consider stop doing this many version after hg-6.9 release |
|
158 | 159 | bndata = repo.cachevfs.read(_rbc_legacy_names) |
|
159 | 160 | v1_fallback = True |
|
161 | self._force_overwrite = True | |
|
160 | 162 | self._rbcsnameslen = len(bndata) # for verification before writing |
|
161 | 163 | if bndata: |
|
162 | 164 | self._names = [ |
@@ -198,7 +200,6 class revbranchcache: | |||
|
198 | 200 | self._names = [] |
|
199 | 201 | self._rbcnamescount = len(self._names) # number of names read at |
|
200 | 202 | # _rbcsnameslen |
|
201 | self._force_overwrite = False | |
|
202 | 203 | |
|
203 | 204 | def _clear(self): |
|
204 | 205 | self._rbcsnameslen = 0 |
@@ -320,7 +321,7 class revbranchcache: | |||
|
320 | 321 | step = b'' |
|
321 | 322 | try: |
|
322 | 323 | # write the new names |
|
323 | if self._rbcnamescount < len(self._names): | |
|
324 | if self._force_overwrite or self._rbcnamescount < len(self._names): | |
|
324 | 325 | wlock = repo.wlock(wait=False) |
|
325 | 326 | step = b' names' |
|
326 | 327 | self._writenames(repo) |
@@ -345,15 +346,24 class revbranchcache: | |||
|
345 | 346 | def _writenames(self, repo): |
|
346 | 347 | """write the new branch names to revbranchcache""" |
|
347 | 348 | f = None |
|
349 | if self._force_overwrite: | |
|
350 | self._rbcsnameslen = 0 | |
|
351 | self._rbcnamescount = 0 | |
|
348 | 352 | try: |
|
349 | if self._rbcnamescount != 0: | |
|
353 | if self._force_overwrite or self._rbcnamescount != 0: | |
|
350 | 354 | f = repo.cachevfs.open(_rbcnames, b'ab') |
|
351 | if f.tell() == self._rbcsnameslen: | |
|
355 | current_size = f.tell() | |
|
356 | if current_size == self._rbcsnameslen: | |
|
352 | 357 | f.write(b'\0') |
|
353 | 358 | else: |
|
354 | 359 | f.close() |
|
355 |
f |
|
|
356 | repo.ui.debug(b"%s changed - rewriting it\n" % _rbcnames) | |
|
360 | if self._force_overwrite: | |
|
361 | dbg = b"resetting content of %s\n" | |
|
362 | elif current_size > 0: | |
|
363 | dbg = b"%s changed - rewriting it\n" | |
|
364 | else: | |
|
365 | dbg = b"%s is missing - rewriting it\n" | |
|
366 | repo.ui.debug(dbg % _rbcnames) | |
|
357 | 367 | self._rbcnamescount = 0 |
|
358 | 368 | self._rbcrevslen = 0 |
|
359 | 369 | if self._rbcnamescount == 0: |
@@ -880,8 +880,8 recovery from invalid cache file with so | |||
|
880 | 880 | Smoothly reuse "v1" format if no v2 exists |
|
881 | 881 | ------------------------------------------ |
|
882 | 882 | |
|
883 |
read only operation with valid data |
|
|
884 | (does not need to rewrite anything, maybe we should force it?) | |
|
883 | read only operation with valid data | |
|
884 | (actively rewrite data) | |
|
885 | 885 | |
|
886 | 886 | $ rm .hg/cache/rbc-names-v2 |
|
887 | 887 | $ rm .hg/cache/rbc-revs-v2 |
@@ -895,17 +895,23 read only operation with valid data( | |||
|
895 | 895 | 5 |
|
896 | 896 | $ f --size .hg/cache/rbc-*-* |
|
897 | 897 | .hg/cache/rbc-names-v1: size=92 |
|
898 | .hg/cache/rbc-names-v2: size=92 | |
|
898 | 899 | .hg/cache/rbc-revs-v1: size=160 |
|
900 | .hg/cache/rbc-revs-v2: size=160 | |
|
899 | 901 | |
|
900 | 902 | |
|
901 | 903 | Write operation write a full v2 files |
|
902 | 904 | |
|
905 | $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1 | |
|
906 | $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1 | |
|
907 | $ f --size .hg/cache/rbc-* | |
|
908 | .hg/cache/rbc-names-v1: size=92 | |
|
909 | .hg/cache/rbc-revs-v1: size=160 | |
|
903 | 910 | $ hg branch not-here-for-long |
|
904 | 911 | marked working directory as branch not-here-for-long |
|
905 | 912 | $ hg ci -m not-long --debug |
|
906 | 913 | reusing manifest from p1 (no file change) |
|
907 | 914 | committing changelog |
|
908 | rbc-names-v2 changed - rewriting it | |
|
909 | 915 | updating the branch cache |
|
910 | 916 | committed changeset * (glob) |
|
911 | 917 | $ f --size .hg/cache/rbc-* |
@@ -927,6 +933,7 With invalid v1 data, we rewrite it too | |||
|
927 | 933 | 5 |
|
928 | 934 | $ f --size .hg/cache/rbc-*-* |
|
929 | 935 | .hg/cache/rbc-names-v1: size=110 |
|
936 | .hg/cache/rbc-names-v2: size=110 | |
|
930 | 937 | .hg/cache/rbc-revs-v1: size=110 |
|
931 | 938 | .hg/cache/rbc-revs-v2: size=168 |
|
932 | 939 | |
@@ -968,7 +975,7 cache is rebuilt when corruption is dete | |||
|
968 | 975 | $ echo > .hg/cache/rbc-names-v2 |
|
969 | 976 | $ hg log -r '5:&branch(.)' -T '{rev} ' --debug |
|
970 | 977 | referenced branch names not found - rebuilding revision branch cache from scratch |
|
971 | 8 9 10 11 12 13 (no-eol) | |
|
978 | 8 9 10 11 12 13 resetting content of rbc-names-v2 | |
|
972 | 979 | $ f --size .hg/cache/rbc-names-* |
|
973 | 980 | .hg/cache/rbc-names-v2: size=84 |
|
974 | 981 | $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null |
@@ -319,7 +319,7 Check that the right ancestors is used w | |||
|
319 | 319 | bundle2-input-part: "phase-heads" supported |
|
320 | 320 | bundle2-input-part: total payload size 24 |
|
321 | 321 | bundle2-input-bundle: 3 parts total |
|
322 |
resetting content of |
|
|
322 | resetting content of rbc-names-v2 | |
|
323 | 323 | added 2 changesets with 2 changes to 1 files |
|
324 | 324 | updating the branch cache |
|
325 | 325 | invalid branch cache (served): tip differs |
@@ -913,7 +913,7 check strip behavior | |||
|
913 | 913 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg |
|
914 | 914 | updating the branch cache |
|
915 | 915 | invalid branch cache (served): tip differs |
|
916 |
resetting content of |
|
|
916 | resetting content of rbc-names-v2 | |
|
917 | 917 | $ hg log -G |
|
918 | 918 | o changeset: 2:5c51d8d6557d |
|
919 | 919 | | tag: tip |
General Comments 0
You need to be logged in to leave comments.
Login now