Show More
@@ -170,6 +170,7 class revbranchcache: | |||||
170 | self._names = [] |
|
170 | self._names = [] | |
171 | self._rbcnamescount = len(self._names) # number of names read at |
|
171 | self._rbcnamescount = len(self._names) # number of names read at | |
172 | # _rbcsnameslen |
|
172 | # _rbcsnameslen | |
|
173 | self._force_overwrite = False | |||
173 |
|
174 | |||
174 | def _clear(self): |
|
175 | def _clear(self): | |
175 | self._rbcsnameslen = 0 |
|
176 | self._rbcsnameslen = 0 | |
@@ -178,6 +179,12 class revbranchcache: | |||||
178 | self._rbcrevslen = len(self._repo.changelog) |
|
179 | self._rbcrevslen = len(self._repo.changelog) | |
179 | self._rbcrevs = rbcrevs(bytearray(self._rbcrevslen * _rbcrecsize)) |
|
180 | self._rbcrevs = rbcrevs(bytearray(self._rbcrevslen * _rbcrecsize)) | |
180 | util.clearcachedproperty(self, b'_namesreverse') |
|
181 | util.clearcachedproperty(self, b'_namesreverse') | |
|
182 | self._force_overwrite = True | |||
|
183 | ||||
|
184 | def invalidate(self, rev=0): | |||
|
185 | self._rbcrevslen = rev | |||
|
186 | self._rbcrevs.truncate(rev) | |||
|
187 | self._force_overwrite = True | |||
181 |
|
188 | |||
182 | @util.propertycache |
|
189 | @util.propertycache | |
183 | def _namesreverse(self): |
|
190 | def _namesreverse(self): | |
@@ -292,7 +299,7 class revbranchcache: | |||||
292 |
|
299 | |||
293 | # write the new revs |
|
300 | # write the new revs | |
294 | start = self._rbcrevslen * _rbcrecsize |
|
301 | start = self._rbcrevslen * _rbcrecsize | |
295 | if start != len(self._rbcrevs): |
|
302 | if self._force_overwrite or start != len(self._rbcrevs): | |
296 | step = b'' |
|
303 | step = b'' | |
297 | if wlock is None: |
|
304 | if wlock is None: | |
298 | wlock = repo.wlock(wait=False) |
|
305 | wlock = repo.wlock(wait=False) | |
@@ -335,6 +342,8 class revbranchcache: | |||||
335 | def _writerevs(self, repo, start): |
|
342 | def _writerevs(self, repo, start): | |
336 | """write the new revs to revbranchcache""" |
|
343 | """write the new revs to revbranchcache""" | |
337 | revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) |
|
344 | revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) | |
|
345 | if self._force_overwrite: | |||
|
346 | start = 0 | |||
338 | with repo.cachevfs.open(_rbcrevs, b'ab') as f: |
|
347 | with repo.cachevfs.open(_rbcrevs, b'ab') as f: | |
339 | current_size = f.tell() |
|
348 | current_size = f.tell() | |
340 | if current_size < start: |
|
349 | if current_size < start: | |
@@ -348,3 +357,4 class revbranchcache: | |||||
348 | end = revs * _rbcrecsize |
|
357 | end = revs * _rbcrecsize | |
349 | f.write(self._rbcrevs.slice(start, end)) |
|
358 | f.write(self._rbcrevs.slice(start, end)) | |
350 | self._rbcrevslen = revs |
|
359 | self._rbcrevslen = revs | |
|
360 | self._force_overwrite = False |
@@ -242,6 +242,10 def strip(ui, repo, nodelist, backup=Tru | |||||
242 | del repo.obsstore |
|
242 | del repo.obsstore | |
243 | repo.invalidatevolatilesets() |
|
243 | repo.invalidatevolatilesets() | |
244 |
|
244 | |||
|
245 | # NOTE: eventually make a common entry point on localrepo to help | |||
|
246 | # other caches | |||
|
247 | repo.revbranchcache().invalidate(striprev) | |||
|
248 | ||||
245 | if tmpbundlefile: |
|
249 | if tmpbundlefile: | |
246 | ui.note(_(b"adding branch\n")) |
|
250 | ui.note(_(b"adding branch\n")) | |
247 | f = vfs.open(tmpbundlefile, b"rb") |
|
251 | f = vfs.open(tmpbundlefile, b"rb") |
@@ -319,12 +319,14 Check that the right ancestors is used w | |||||
319 | bundle2-input-part: "phase-heads" supported |
|
319 | bundle2-input-part: "phase-heads" supported | |
320 | bundle2-input-part: total payload size 24 |
|
320 | bundle2-input-part: total payload size 24 | |
321 | bundle2-input-bundle: 3 parts total |
|
321 | bundle2-input-bundle: 3 parts total | |
322 |
truncating cache/rbc-revs-v1 to |
|
322 | truncating cache/rbc-revs-v1 to 0 | |
323 | added 2 changesets with 2 changes to 1 files |
|
323 | added 2 changesets with 2 changes to 1 files | |
324 | updating the branch cache |
|
324 | updating the branch cache | |
325 | invalid branch cache (served): tip differs |
|
325 | invalid branch cache (served): tip differs | |
|
326 | history modification detected - truncating revision branch cache to revision 1 | |||
326 | invalid branch cache (served.hidden): tip differs |
|
327 | invalid branch cache (served.hidden): tip differs | |
327 | rebase completed |
|
328 | rebase completed | |
|
329 | truncating cache/rbc-revs-v1 to 8 | |||
328 |
|
330 | |||
329 | Test minimization of merge conflicts |
|
331 | Test minimization of merge conflicts | |
330 | $ hg up -q null |
|
332 | $ hg up -q null |
@@ -913,6 +913,7 check strip behavior | |||||
913 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg |
|
913 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg | |
914 | updating the branch cache |
|
914 | updating the branch cache | |
915 | invalid branch cache (served): tip differs |
|
915 | invalid branch cache (served): tip differs | |
|
916 | truncating cache/rbc-revs-v1 to 0 | |||
916 | $ hg log -G |
|
917 | $ hg log -G | |
917 | o changeset: 2:5c51d8d6557d |
|
918 | o changeset: 2:5c51d8d6557d | |
918 | | tag: tip |
|
919 | | tag: tip |
General Comments 0
You need to be logged in to leave comments.
Login now