changeset 15455:c6f87bdab2a1

phases: add rollback support
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 07 Nov 2011 12:27:25 +0100
parents 5a7dde5adec8
children abcaaf51d568
files mercurial/localrepo.py tests/test-fncache.t tests/test-hardlinks.t tests/test-hup.t tests/test-inherit-mode.t
diffstat 5 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Nov 07 14:11:01 2011 +0100
+++ b/mercurial/localrepo.py	Mon Nov 07 12:27:25 2011 +0100
@@ -758,10 +758,16 @@
             util.copyfile(bkname, self.join('journal.bookmarks'))
         else:
             self.opener.write('journal.bookmarks', '')
+        phasesname = self.sjoin('phaseroots')
+        if os.path.exists(phasesname):
+            util.copyfile(phasesname, self.sjoin('journal.phaseroots'))
+        else:
+            self.sopener.write('journal.phaseroots', '')
 
         return (self.sjoin('journal'), self.join('journal.dirstate'),
                 self.join('journal.branch'), self.join('journal.desc'),
-                self.join('journal.bookmarks'))
+                self.join('journal.bookmarks'),
+                self.sjoin('journal.phaseroots'))
 
     def recover(self):
         lock = self.lock()
@@ -826,6 +832,9 @@
         if os.path.exists(self.join('undo.bookmarks')):
             util.rename(self.join('undo.bookmarks'),
                         self.join('bookmarks'))
+        if os.path.exists(self.sjoin('undo.phaseroots')):
+            util.rename(self.sjoin('undo.phaseroots'),
+                        self.sjoin('phaseroots'))
         self.invalidate()
 
         parentgone = (parents[0] not in self.changelog.nodemap or
--- a/tests/test-fncache.t	Mon Nov 07 14:11:01 2011 +0100
+++ b/tests/test-fncache.t	Mon Nov 07 12:27:25 2011 +0100
@@ -80,6 +80,7 @@
   .hg/undo.branch
   .hg/undo.desc
   .hg/undo.dirstate
+  .hg/undo.phaseroots
   $ cd ..
 
 Non fncache repo:
@@ -103,6 +104,7 @@
   .hg/store/data/tst.d.hg
   .hg/store/data/tst.d.hg/_foo.i
   .hg/store/undo
+  .hg/store/undo.phaseroots
   .hg/undo.bookmarks
   .hg/undo.branch
   .hg/undo.desc
--- a/tests/test-hardlinks.t	Mon Nov 07 14:11:01 2011 +0100
+++ b/tests/test-hardlinks.t	Mon Nov 07 12:27:25 2011 +0100
@@ -48,6 +48,7 @@
   1 r1/.hg/store/data/f1.i
   1 r1/.hg/store/fncache
   1 r1/.hg/store/undo
+  1 r1/.hg/store/undo.phaseroots
 
 
 Create hardlinked clone r2:
@@ -76,6 +77,7 @@
   2 r1/.hg/store/data/f1.i
   2 r1/.hg/store/fncache
   1 r1/.hg/store/undo
+  1 r1/.hg/store/undo.phaseroots
 
   $ nlinksdir r2/.hg/store
   2 r2/.hg/store/00changelog.i
@@ -93,6 +95,7 @@
   1 r3/.hg/store/data/f1.i
   1 r3/.hg/store/fncache
   1 r3/.hg/store/undo
+  1 r3/.hg/store/undo.phaseroots
 
 
 Create a non-inlined filelog in r3:
@@ -113,6 +116,7 @@
   1 r3/.hg/store/data/f1.i
   1 r3/.hg/store/fncache
   1 r3/.hg/store/undo
+  1 r3/.hg/store/undo.phaseroots
 
 Push to repo r1 should break up most hardlinks in r2:
 
@@ -196,6 +200,7 @@
   2 r4/.hg/store/data/f1.i
   2 r4/.hg/store/fncache
   2 r4/.hg/store/undo
+  2 r4/.hg/store/undo.phaseroots
   2 r4/.hg/undo.bookmarks
   2 r4/.hg/undo.branch
   2 r4/.hg/undo.desc
@@ -225,6 +230,7 @@
   2 r4/.hg/store/data/f1.i
   2 r4/.hg/store/fncache
   2 r4/.hg/store/undo
+  2 r4/.hg/store/undo.phaseroots
   2 r4/.hg/undo.bookmarks
   2 r4/.hg/undo.branch
   2 r4/.hg/undo.desc
--- a/tests/test-hup.t	Mon Nov 07 14:11:01 2011 +0100
+++ b/tests/test-hup.t	Mon Nov 07 12:27:25 2011 +0100
@@ -17,4 +17,4 @@
   rollback completed
   killed!
   $ echo .hg/* .hg/store/*
-  .hg/00changelog.i .hg/journal.bookmarks .hg/journal.branch .hg/journal.desc .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a
+  .hg/00changelog.i .hg/journal.bookmarks .hg/journal.branch .hg/journal.desc .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a .hg/store/journal.phaseroots
--- a/tests/test-inherit-mode.t	Mon Nov 07 14:11:01 2011 +0100
+++ b/tests/test-inherit-mode.t	Mon Nov 07 12:27:25 2011 +0100
@@ -77,6 +77,7 @@
   00660 ./.hg/store/data/foo.i
   00660 ./.hg/store/fncache
   00660 ./.hg/store/undo
+  00660 ./.hg/store/undo.phaseroots
   00660 ./.hg/undo.bookmarks
   00660 ./.hg/undo.branch
   00660 ./.hg/undo.desc
@@ -118,6 +119,7 @@
   00660 ../push/.hg/store/data/foo.i
   00660 ../push/.hg/store/fncache
   00660 ../push/.hg/store/undo
+  00660 ../push/.hg/store/undo.phaseroots
   00660 ../push/.hg/undo.bookmarks
   00660 ../push/.hg/undo.branch
   00660 ../push/.hg/undo.desc