##// END OF EJS Templates
localrepo: stop doing special dirstate backup at transaction open...
marmoute -
r50980:ff12f424 default
parent child Browse files
Show More
@@ -2548,8 +2548,6 b' class localrepository:'
2548 # out) in this transaction
2548 # out) in this transaction
2549 narrowspec.restorebackup(self, b'journal.narrowspec')
2549 narrowspec.restorebackup(self, b'journal.narrowspec')
2550 narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate')
2550 narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate')
2551 if repo.currentwlock() is not None:
2552 repo.dirstate.restorebackup(None, b'journal.dirstate')
2553
2551
2554 repo.invalidate(clearfilecache=True)
2552 repo.invalidate(clearfilecache=True)
2555
2553
@@ -2676,31 +2674,21 b' class localrepository:'
2676 return tr
2674 return tr
2677
2675
2678 def _journalfiles(self):
2676 def _journalfiles(self):
2679 first = (
2677 return (
2680 (self.svfs, b'journal'),
2678 (self.svfs, b'journal'),
2681 (self.svfs, b'journal.narrowspec'),
2679 (self.svfs, b'journal.narrowspec'),
2682 (self.vfs, b'journal.narrowspec.dirstate'),
2680 (self.vfs, b'journal.narrowspec.dirstate'),
2683 (self.vfs, b'journal.dirstate'),
2684 )
2685 middle = []
2686 dirstate_data = self.dirstate.data_backup_filename(b'journal.dirstate')
2687 if dirstate_data is not None:
2688 middle.append((self.vfs, dirstate_data))
2689 end = (
2690 (self.vfs, b'journal.branch'),
2681 (self.vfs, b'journal.branch'),
2691 (self.vfs, b'journal.desc'),
2682 (self.vfs, b'journal.desc'),
2692 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
2683 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
2693 (self.svfs, b'journal.phaseroots'),
2684 (self.svfs, b'journal.phaseroots'),
2694 )
2685 )
2695 return first + tuple(middle) + end
2696
2686
2697 def undofiles(self):
2687 def undofiles(self):
2698 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
2688 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
2699
2689
2700 @unfilteredmethod
2690 @unfilteredmethod
2701 def _writejournal(self, desc):
2691 def _writejournal(self, desc):
2702 if self.currentwlock() is not None:
2703 self.dirstate.savebackup(None, b'journal.dirstate')
2704 narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate')
2692 narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate')
2705 narrowspec.savebackup(self, b'journal.narrowspec')
2693 narrowspec.savebackup(self, b'journal.narrowspec')
2706 self.vfs.write(
2694 self.vfs.write(
@@ -2808,11 +2796,20 b' class localrepository:'
2808 if self.svfs.exists(b'undo.phaseroots'):
2796 if self.svfs.exists(b'undo.phaseroots'):
2809 self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True)
2797 self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True)
2810 self.invalidate()
2798 self.invalidate()
2799 self.dirstate.invalidate()
2811
2800
2812 if parentgone:
2801 if parentgone:
2802 # replace this with some explicit parent update in the future.
2803 has_node = self.changelog.index.has_node
2804 if not all(has_node(p) for p in self.dirstate._pl):
2805 # There was no dirstate to backup initially, we need to drop
2806 # the existing one.
2807 with self.dirstate.changing_parents(self):
2808 self.dirstate.setparents(self.nullid)
2809 self.dirstate.clear()
2810
2813 narrowspec.restorebackup(self, b'undo.narrowspec')
2811 narrowspec.restorebackup(self, b'undo.narrowspec')
2814 narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
2812 narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
2815 self.dirstate.restorebackup(None, b'undo.dirstate')
2816 try:
2813 try:
2817 branch = self.vfs.read(b'undo.branch')
2814 branch = self.vfs.read(b'undo.branch')
2818 self.dirstate.setbranch(encoding.tolocal(branch))
2815 self.dirstate.setbranch(encoding.tolocal(branch))
@@ -261,11 +261,10 b' r4 has hardlinks in the working dir (not'
261 2 r4/.hg/store/undo.backup.phaseroots
261 2 r4/.hg/store/undo.backup.phaseroots
262 2 r4/.hg/store/undo.backupfiles
262 2 r4/.hg/store/undo.backupfiles
263 2 r4/.hg/store/undo.phaseroots
263 2 r4/.hg/store/undo.phaseroots
264 [24] r4/\.hg/undo\.backup\.dirstate (re)
264 2 r4/\.hg/undo\.backup\.dirstate (re)
265 2 r4/.hg/undo.bookmarks
265 2 r4/.hg/undo.bookmarks
266 2 r4/.hg/undo.branch
266 2 r4/.hg/undo.branch
267 2 r4/.hg/undo.desc
267 2 r4/.hg/undo.desc
268 [24] r4/\.hg/undo\.dirstate (re)
269 2 r4/.hg/wcache/checkisexec (execbit !)
268 2 r4/.hg/wcache/checkisexec (execbit !)
270 2 r4/.hg/wcache/checklink-target (symlink !)
269 2 r4/.hg/wcache/checklink-target (symlink !)
271 2 r4/.hg/wcache/checknoexec (execbit !)
270 2 r4/.hg/wcache/checknoexec (execbit !)
@@ -279,7 +278,7 b' Update back to revision 12 in r4 should '
279 #if hardlink-whitelisted
278 #if hardlink-whitelisted
280 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
279 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
281 2 r4/.hg/dirstate
280 2 r4/.hg/dirstate
282 4 r4/.hg/undo.backup.dirstate
281 2 r4/.hg/undo.backup.dirstate
283 #endif
282 #endif
284
283
285
284
@@ -319,11 +318,10 b' Update back to revision 12 in r4 should '
319 2 r4/.hg/store/undo.backup.phaseroots
318 2 r4/.hg/store/undo.backup.phaseroots
320 2 r4/.hg/store/undo.backupfiles
319 2 r4/.hg/store/undo.backupfiles
321 2 r4/.hg/store/undo.phaseroots
320 2 r4/.hg/store/undo.phaseroots
322 [24] r4/\.hg/undo\.backup\.dirstate (re)
321 2 r4/\.hg/undo\.backup\.dirstate (re)
323 2 r4/.hg/undo.bookmarks
322 2 r4/.hg/undo.bookmarks
324 2 r4/.hg/undo.branch
323 2 r4/.hg/undo.branch
325 2 r4/.hg/undo.desc
324 2 r4/.hg/undo.desc
326 [24] r4/\.hg/undo\.dirstate (re)
327 2 r4/.hg/wcache/checkisexec (execbit !)
325 2 r4/.hg/wcache/checkisexec (execbit !)
328 2 r4/.hg/wcache/checklink-target (symlink !)
326 2 r4/.hg/wcache/checklink-target (symlink !)
329 2 r4/.hg/wcache/checknoexec (execbit !)
327 2 r4/.hg/wcache/checknoexec (execbit !)
@@ -337,7 +335,7 b' Update back to revision 12 in r4 should '
337 #if hardlink-whitelisted
335 #if hardlink-whitelisted
338 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
336 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
339 1 r4/.hg/dirstate
337 1 r4/.hg/dirstate
340 4 r4/.hg/undo.backup.dirstate
338 2 r4/.hg/undo.backup.dirstate
341 #endif
339 #endif
342
340
343 Test hardlinking outside hg:
341 Test hardlinking outside hg:
@@ -393,7 +393,6 b' New operations are blocked with the corr'
393 .hg/merge/state
393 .hg/merge/state
394 .hg/rebasestate
394 .hg/rebasestate
395 .hg/undo.backup.dirstate
395 .hg/undo.backup.dirstate
396 .hg/undo.dirstate
397 .hg/updatestate
396 .hg/updatestate
398
397
399 $ hg rebase -s 3 -d tip
398 $ hg rebase -s 3 -d tip
General Comments 0
You need to be logged in to leave comments. Login now