##// END OF EJS Templates
transaction: include backup file in the "undo" transaction...
Pierre-Yves David -
r23904:d251da5e default
parent child Browse files
Show More
@@ -405,6 +405,7 b' class transaction(object):'
405 self.report("couldn't remote %s: %s\n"
405 self.report("couldn't remote %s: %s\n"
406 % (vfs.join(b), inst))
406 % (vfs.join(b), inst))
407 self.entries = []
407 self.entries = []
408 self._writeundo()
408 if self.after:
409 if self.after:
409 self.after()
410 self.after()
410 if self.opener.isfile(self.journal):
411 if self.opener.isfile(self.journal):
@@ -440,6 +441,32 b' class transaction(object):'
440 scope)'''
441 scope)'''
441 self._abort()
442 self._abort()
442
443
444 def _writeundo(self):
445 """write transaction data for possible future undo call"""
446 if self.undoname is None:
447 return
448 undobackupfile = self.opener.open("%s.backupfiles" % self.undoname, 'w')
449 undobackupfile.write('%d\n' % version)
450 for l, f, b, c in self._backupentries:
451 if not f: # temporary file
452 continue
453 if not b:
454 u = ''
455 else:
456 if l not in self._vfsmap and c:
457 self.report("couldn't remote %s: unknown cache location"
458 "%s\n" % (b, l))
459 continue
460 vfs = self._vfsmap[l]
461 base, name = vfs.split(b)
462 assert name.startswith(self.journal), name
463 uname = name.replace(self.journal, self.undoname, 1)
464 u = vfs.reljoin(base, uname)
465 util.copyfile(vfs.join(b), vfs.join(u), hardlink=True)
466 undobackupfile.write("%s\0%s\0%s\0%d\n" % (l, f, u, c))
467 undobackupfile.close()
468
469
443 def _abort(self):
470 def _abort(self):
444 self.count = 0
471 self.count = 0
445 self.usages = 0
472 self.usages = 0
@@ -81,6 +81,7 b' Non store repo:'
81 .hg/phaseroots
81 .hg/phaseroots
82 .hg/requires
82 .hg/requires
83 .hg/undo
83 .hg/undo
84 .hg/undo.backupfiles
84 .hg/undo.bookmarks
85 .hg/undo.bookmarks
85 .hg/undo.branch
86 .hg/undo.branch
86 .hg/undo.desc
87 .hg/undo.desc
@@ -114,6 +115,7 b' Non fncache repo:'
114 .hg/store/data/tst.d.hg/_foo.i
115 .hg/store/data/tst.d.hg/_foo.i
115 .hg/store/phaseroots
116 .hg/store/phaseroots
116 .hg/store/undo
117 .hg/store/undo
118 .hg/store/undo.backupfiles
117 .hg/store/undo.phaseroots
119 .hg/store/undo.phaseroots
118 .hg/undo.bookmarks
120 .hg/undo.bookmarks
119 .hg/undo.branch
121 .hg/undo.branch
@@ -50,6 +50,8 b' Prepare repo r1:'
50 1 r1/.hg/store/fncache
50 1 r1/.hg/store/fncache
51 1 r1/.hg/store/phaseroots
51 1 r1/.hg/store/phaseroots
52 1 r1/.hg/store/undo
52 1 r1/.hg/store/undo
53 1 r1/.hg/store/undo.backup.fncache
54 1 r1/.hg/store/undo.backupfiles
53 1 r1/.hg/store/undo.phaseroots
55 1 r1/.hg/store/undo.phaseroots
54
56
55
57
@@ -80,6 +82,8 b' Repos r1 and r2 should now contain hardl'
80 2 r1/.hg/store/fncache
82 2 r1/.hg/store/fncache
81 1 r1/.hg/store/phaseroots
83 1 r1/.hg/store/phaseroots
82 1 r1/.hg/store/undo
84 1 r1/.hg/store/undo
85 1 r1/.hg/store/undo.backup.fncache
86 1 r1/.hg/store/undo.backupfiles
83 1 r1/.hg/store/undo.phaseroots
87 1 r1/.hg/store/undo.phaseroots
84
88
85 $ nlinksdir r2/.hg/store
89 $ nlinksdir r2/.hg/store
@@ -99,6 +103,7 b' Repo r3 should not be hardlinked:'
99 1 r3/.hg/store/fncache
103 1 r3/.hg/store/fncache
100 1 r3/.hg/store/phaseroots
104 1 r3/.hg/store/phaseroots
101 1 r3/.hg/store/undo
105 1 r3/.hg/store/undo
106 1 r3/.hg/store/undo.backupfiles
102 1 r3/.hg/store/undo.phaseroots
107 1 r3/.hg/store/undo.phaseroots
103
108
104
109
@@ -124,6 +129,9 b' Create a non-inlined filelog in r3:'
124 1 r3/.hg/store/fncache
129 1 r3/.hg/store/fncache
125 1 r3/.hg/store/phaseroots
130 1 r3/.hg/store/phaseroots
126 1 r3/.hg/store/undo
131 1 r3/.hg/store/undo
132 1 r3/.hg/store/undo.backup.fncache
133 1 r3/.hg/store/undo.backup.phaseroots
134 1 r3/.hg/store/undo.backupfiles
127 1 r3/.hg/store/undo.phaseroots
135 1 r3/.hg/store/undo.phaseroots
128
136
129 Push to repo r1 should break up most hardlinks in r2:
137 Push to repo r1 should break up most hardlinks in r2:
@@ -151,7 +159,7 b' Push to repo r1 should break up most har'
151 1 r2/.hg/store/00manifest.i
159 1 r2/.hg/store/00manifest.i
152 1 r2/.hg/store/data/d1/f2.i
160 1 r2/.hg/store/data/d1/f2.i
153 2 r2/.hg/store/data/f1.i
161 2 r2/.hg/store/data/f1.i
154 1 r2/.hg/store/fncache
162 2 r2/.hg/store/fncache
155
163
156 $ hg -R r2 verify
164 $ hg -R r2 verify
157 checking changesets
165 checking changesets
@@ -176,7 +184,7 b' Committing a change to f1 in r1 must bre'
176 1 r2/.hg/store/00manifest.i
184 1 r2/.hg/store/00manifest.i
177 1 r2/.hg/store/data/d1/f2.i
185 1 r2/.hg/store/data/d1/f2.i
178 1 r2/.hg/store/data/f1.i
186 1 r2/.hg/store/data/f1.i
179 1 r2/.hg/store/fncache
187 2 r2/.hg/store/fncache
180
188
181
189
182 $ cd r3
190 $ cd r3
@@ -210,6 +218,9 b' r4 has hardlinks in the working dir (not'
210 2 r4/.hg/store/fncache
218 2 r4/.hg/store/fncache
211 2 r4/.hg/store/phaseroots
219 2 r4/.hg/store/phaseroots
212 2 r4/.hg/store/undo
220 2 r4/.hg/store/undo
221 2 r4/.hg/store/undo.backup.fncache
222 2 r4/.hg/store/undo.backup.phaseroots
223 2 r4/.hg/store/undo.backupfiles
213 2 r4/.hg/store/undo.phaseroots
224 2 r4/.hg/store/undo.phaseroots
214 2 r4/.hg/undo.bookmarks
225 2 r4/.hg/undo.bookmarks
215 2 r4/.hg/undo.branch
226 2 r4/.hg/undo.branch
@@ -242,6 +253,9 b' Update back to revision 11 in r4 should '
242 2 r4/.hg/store/fncache
253 2 r4/.hg/store/fncache
243 2 r4/.hg/store/phaseroots
254 2 r4/.hg/store/phaseroots
244 2 r4/.hg/store/undo
255 2 r4/.hg/store/undo
256 2 r4/.hg/store/undo.backup.fncache
257 2 r4/.hg/store/undo.backup.phaseroots
258 2 r4/.hg/store/undo.backupfiles
245 2 r4/.hg/store/undo.phaseroots
259 2 r4/.hg/store/undo.phaseroots
246 2 r4/.hg/undo.bookmarks
260 2 r4/.hg/undo.bookmarks
247 2 r4/.hg/undo.branch
261 2 r4/.hg/undo.branch
@@ -158,6 +158,8 b' more there after'
158 journal.phaseroots
158 journal.phaseroots
159 phaseroots
159 phaseroots
160 undo
160 undo
161 undo.backup.fncache
162 undo.backupfiles
161 undo.phaseroots
163 undo.phaseroots
162
164
163
165
@@ -81,6 +81,7 b' new directories are setgid'
81 00660 ./.hg/store/fncache
81 00660 ./.hg/store/fncache
82 00660 ./.hg/store/phaseroots
82 00660 ./.hg/store/phaseroots
83 00660 ./.hg/store/undo
83 00660 ./.hg/store/undo
84 00660 ./.hg/store/undo.backupfiles
84 00660 ./.hg/store/undo.phaseroots
85 00660 ./.hg/store/undo.phaseroots
85 00660 ./.hg/undo.bookmarks
86 00660 ./.hg/undo.bookmarks
86 00660 ./.hg/undo.branch
87 00660 ./.hg/undo.branch
@@ -125,6 +126,7 b' group can still write everything'
125 00660 ../push/.hg/store/data/foo.i
126 00660 ../push/.hg/store/data/foo.i
126 00660 ../push/.hg/store/fncache
127 00660 ../push/.hg/store/fncache
127 00660 ../push/.hg/store/undo
128 00660 ../push/.hg/store/undo
129 00660 ../push/.hg/store/undo.backupfiles
128 00660 ../push/.hg/store/undo.phaseroots
130 00660 ../push/.hg/store/undo.phaseroots
129 00660 ../push/.hg/undo.bookmarks
131 00660 ../push/.hg/undo.bookmarks
130 00660 ../push/.hg/undo.branch
132 00660 ../push/.hg/undo.branch
General Comments 0
You need to be logged in to leave comments. Login now