From 39f8b3109f29f253fdcc50c62d6d71e8622c3816 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Fri, 24 Jan 2020 14:45:01 -0800 Subject: [PATCH] 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 --- eden/scm/edenscm/mercurial/localrepo.py | 4 ++++ eden/scm/tests/test-empty-t.py | 3 ++- eden/scm/tests/test-hook.t | 2 ++ eden/scm/tests/test-inherit-mode.t | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/eden/scm/edenscm/mercurial/localrepo.py b/eden/scm/edenscm/mercurial/localrepo.py index 66f1dee0ef..b4f57cdaa7 100644 --- a/eden/scm/edenscm/mercurial/localrepo.py +++ b/eden/scm/edenscm/mercurial/localrepo.py @@ -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 = ( diff --git a/eden/scm/tests/test-empty-t.py b/eden/scm/tests/test-empty-t.py index cb1bdeeac4..31d0a2f9fa 100644 --- a/eden/scm/tests/test-empty-t.py +++ b/eden/scm/tests/test-empty-t.py @@ -81,6 +81,7 @@ sh % "ls .hg/store" == r""" undo undo.backupfiles undo.bookmarks - undo.phaseroots""" + undo.phaseroots + undo.visibleheads""" sh % "cd .." diff --git a/eden/scm/tests/test-hook.t b/eden/scm/tests/test-hook.t index d78dd359da..cbd88afdc7 100644 --- a/eden/scm/tests/test-hook.t +++ b/eden/scm/tests/test-hook.t @@ -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 diff --git a/eden/scm/tests/test-inherit-mode.t b/eden/scm/tests/test-inherit-mode.t index 21eebd6f4e..c915eb9f76 100644 --- a/eden/scm/tests/test-inherit-mode.t +++ b/eden/scm/tests/test-inherit-mode.t @@ -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