##// END OF EJS Templates
phases: explicitly filter stripped revision at strip time...
marmoute -
r52294:8f2ea3fa default
parent child Browse files
Show More
@@ -3371,17 +3371,6 b' class localrepository:'
3371 Intended for use by strip and rollback, so there's a common
3371 Intended for use by strip and rollback, so there's a common
3372 place for anything that has to be done after destroying history.
3372 place for anything that has to be done after destroying history.
3373 """
3373 """
3374 # When one tries to:
3375 # 1) destroy nodes thus calling this method (e.g. strip)
3376 # 2) use phasecache somewhere (e.g. commit)
3377 #
3378 # then 2) will fail because the phasecache contains nodes that were
3379 # removed. We can either remove phasecache from the filecache,
3380 # causing it to reload next time it is accessed, or simply filter
3381 # the removed nodes now and write the updated cache.
3382 self._phasecache.filterunknown(self)
3383 self._phasecache.write()
3384
3385 # refresh all repository caches
3374 # refresh all repository caches
3386 self.updatecaches()
3375 self.updatecaches()
3387
3376
@@ -702,6 +702,24 b' class phasecache:'
702 return True
702 return True
703 return False
703 return False
704
704
705 def register_strip(
706 self,
707 repo: "localrepo.localrepository",
708 tr,
709 strip_rev: int,
710 ):
711 """announce a strip to the phase cache
712
713 Any roots higher than the stripped revision should be dropped.
714 """
715 assert repo.filtername is None
716 to_rev = repo.changelog.index.rev
717 for targetphase, nodes in list(self.phaseroots.items()):
718 filtered = {n for n in nodes if to_rev(n) >= strip_rev}
719 if filtered:
720 self._updateroots(targetphase, nodes - filtered, tr)
721 self.invalidate()
722
705 def filterunknown(self, repo: "localrepo.localrepository") -> None:
723 def filterunknown(self, repo: "localrepo.localrepository") -> None:
706 """remove unknown nodes from the phase boundary
724 """remove unknown nodes from the phase boundary
707
725
@@ -218,6 +218,7 b' def strip(ui, repo, nodelist, backup=Tru'
218 oldfiles = set(tr._offsetmap.keys())
218 oldfiles = set(tr._offsetmap.keys())
219 oldfiles.update(tr._newfiles)
219 oldfiles.update(tr._newfiles)
220
220
221 repo._phasecache.register_strip(repo, tr, striprev)
221 tr.startgroup()
222 tr.startgroup()
222 cl.strip(striprev, tr)
223 cl.strip(striprev, tr)
223 stripmanifest(repo, striprev, tr, files)
224 stripmanifest(repo, striprev, tr, files)
@@ -239,7 +240,6 b' def strip(ui, repo, nodelist, backup=Tru'
239 deleteobsmarkers(repo.obsstore, stripobsidx)
240 deleteobsmarkers(repo.obsstore, stripobsidx)
240 del repo.obsstore
241 del repo.obsstore
241 repo.invalidatevolatilesets()
242 repo.invalidatevolatilesets()
242 repo._phasecache.filterunknown(repo)
243
243
244 if tmpbundlefile:
244 if tmpbundlefile:
245 ui.note(_(b"adding branch\n"))
245 ui.note(_(b"adding branch\n"))
General Comments 0
You need to be logged in to leave comments. Login now