visibility: add visibleheads to journaled files

Summary:
The visibleheads file should be journaled like the other state files, so that
it is rolled back if a transaction aborts.

Reviewed By: quark-zju

Differential Revision: D19502226

fbshipit-source-id: c2b8d926ce97211411ca01f05e83e62cb77625b9
This commit is contained in:
Mark Thomas 2020-01-24 14:45:01 -08:00 committed by Facebook Github Bot
parent 4bc06df032
commit 39f8b3109f
4 changed files with 10 additions and 1 deletions

View File

@ -1520,6 +1520,7 @@ class localrepository(object):
(self.localvfs, "journal.desc"),
(self.svfs, "journal.bookmarks"),
(self.svfs, "journal.phaseroots"),
(self.svfs, "journal.visibleheads"),
)
def undofiles(self):
@ -1534,6 +1535,7 @@ class localrepository(object):
self.localvfs.write("journal.desc", "%d\n%s\n" % (len(self), desc))
self.svfs.write("journal.bookmarks", self.svfs.tryread("bookmarks"))
self.svfs.write("journal.phaseroots", self.svfs.tryread("phaseroots"))
self.svfs.write("journal.visibleheads", self.svfs.tryread("visibleheads"))
def recover(self):
with self.lock():
@ -1615,6 +1617,8 @@ class localrepository(object):
self.svfs.rename("undo.bookmarks", "bookmarks", checkambig=True)
if self.svfs.exists("undo.phaseroots"):
self.svfs.rename("undo.phaseroots", "phaseroots", checkambig=True)
if self.svfs.exists("undo.visibleheads"):
self.svfs.rename("undo.visibleheads", "visibleheads", checkambig=True)
self.invalidate()
parentgone = (

View File

@ -81,6 +81,7 @@ sh % "ls .hg/store" == r"""
undo
undo.backupfiles
undo.bookmarks
undo.phaseroots"""
undo.phaseroots
undo.visibleheads"""
sh % "cd .."

View File

@ -164,6 +164,7 @@ more there after
hgcommits
journal.bookmarks
journal.phaseroots
journal.visibleheads
metalog
phaseroots
requires
@ -172,6 +173,7 @@ more there after
undo.backupfiles
undo.bookmarks
undo.phaseroots
undo.visibleheads
precommit hook can prevent commit

View File

@ -110,6 +110,7 @@ new directories are setgid
00660 ./.hg/store/undo.backupfiles
00660 ./.hg/store/undo.bookmarks
00660 ./.hg/store/undo.phaseroots
00660 ./.hg/store/undo.visibleheads
00700 ./.hg/treestate/
00600 ./.hg/treestate/* (glob)
00660 ./.hg/undo.backup.dirstate
@ -177,6 +178,7 @@ XXX: treestate and allheads do not really respect this rule
00660 ../push/.hg/store/undo.backupfiles
00660 ../push/.hg/store/undo.bookmarks
00660 ../push/.hg/store/undo.phaseroots
00660 ../push/.hg/store/undo.visibleheads
00700 ../push/.hg/treestate/
00600 ../push/.hg/treestate/* (glob)
00660 ../push/.hg/undo.branch