##// END OF EJS Templates
transactions: fix hg recover with fncache backups...
Durham Goode -
r23063:cd86a670 stable
parent child Browse files
Show More
@@ -349,8 +349,9 b' def rollback(opener, file, report):'
349 data = fp.read()
349 data = fp.read()
350 if len(data) > 0:
350 if len(data) > 0:
351 parts = data.split('\0')
351 parts = data.split('\0')
352 for i in xrange(0, len(parts), 2):
352 # Skip the final part, since it's just a trailing empty space
353 f, b = parts[i:i + 1]
353 for i in xrange(0, len(parts) - 1, 2):
354 f, b = parts[i:i + 2]
354 backupentries.append((f, b, None))
355 backupentries.append((f, b, None))
355
356
356 _playback(file, report, opener, entries, backupentries)
357 _playback(file, report, opener, entries, backupentries)
@@ -236,3 +236,46 b' Aborting transaction prevents fncache ch'
236 [255]
236 [255]
237 $ cat .hg/store/fncache
237 $ cat .hg/store/fncache
238 data/y.i
238 data/y.i
239
240 Aborted transactions can be recovered later
241
242 $ cat > ../exceptionext.py <<EOF
243 > import os
244 > from mercurial import commands, util, transaction
245 > from mercurial.extensions import wrapfunction
246 >
247 > def closewrapper(orig, self, *args, **kwargs):
248 > origonclose = self.onclose
249 > def onclose():
250 > origonclose()
251 > raise util.Abort("forced transaction failure")
252 > self.onclose = onclose
253 > return orig(self, *args, **kwargs)
254 >
255 > def abortwrapper(orig, self, *args, **kwargs):
256 > raise util.Abort("forced transaction failure")
257 >
258 > def uisetup(ui):
259 > wrapfunction(transaction.transaction, 'close', closewrapper)
260 > wrapfunction(transaction.transaction, '_abort', abortwrapper)
261 >
262 > cmdtable = {}
263 >
264 > EOF
265 $ rm -f "${extpath}c"
266 $ hg up -q 1
267 $ touch z
268 $ hg ci -qAm z 2>/dev/null
269 [255]
270 $ cat .hg/store/fncache | sort
271 data/y.i
272 data/z.i
273 $ hg recover
274 rolling back interrupted transaction
275 checking changesets
276 checking manifests
277 crosschecking files in changesets and manifests
278 checking files
279 1 files, 1 changesets, 1 total revisions
280 $ cat .hg/store/fncache
281 data/y.i
General Comments 0
You need to be logged in to leave comments. Login now