##// END OF EJS Templates
rollback: explicitly skip dirstate rollback when applicable...
marmoute -
r50965:c8f32aa8 default
parent child Browse files
Show More
@@ -10,6 +10,7 b''
10 import functools
10 import functools
11 import os
11 import os
12 import random
12 import random
13 import re
13 import sys
14 import sys
14 import time
15 import time
15 import weakref
16 import weakref
@@ -100,6 +101,8 b' release = lockmod.release'
100 urlerr = util.urlerr
101 urlerr = util.urlerr
101 urlreq = util.urlreq
102 urlreq = util.urlreq
102
103
104 RE_SKIP_DIRSTATE_ROLLBACK = re.compile(b"^(dirstate|narrowspec.dirstate).*")
105
103 # set of (path, vfs-location) tuples. vfs-location is:
106 # set of (path, vfs-location) tuples. vfs-location is:
104 # - 'plain for vfs relative paths
107 # - 'plain for vfs relative paths
105 # - '' for svfs relative paths
108 # - '' for svfs relative paths
@@ -2748,8 +2751,16 b' class localrepository:'
2748
2751
2749 self.destroying()
2752 self.destroying()
2750 vfsmap = {b'plain': self.vfs, b'': self.svfs}
2753 vfsmap = {b'plain': self.vfs, b'': self.svfs}
2754 skip_journal_pattern = None
2755 if not parentgone:
2756 skip_journal_pattern = RE_SKIP_DIRSTATE_ROLLBACK
2751 transaction.rollback(
2757 transaction.rollback(
2752 self.svfs, vfsmap, b'undo', ui.warn, checkambigfiles=_cachedfiles
2758 self.svfs,
2759 vfsmap,
2760 b'undo',
2761 ui.warn,
2762 checkambigfiles=_cachedfiles,
2763 skip_journal_pattern=skip_journal_pattern,
2753 )
2764 )
2754 bookmarksvfs = bookmarks.bookmarksvfs(self)
2765 bookmarksvfs = bookmarks.bookmarksvfs(self)
2755 if bookmarksvfs.exists(b'undo.bookmarks'):
2766 if bookmarksvfs.exists(b'undo.bookmarks'):
@@ -738,7 +738,14 b' BAD_VERSION_MSG = _('
738 )
738 )
739
739
740
740
741 def rollback(opener, vfsmap, file, report, checkambigfiles=None):
741 def rollback(
742 opener,
743 vfsmap,
744 file,
745 report,
746 checkambigfiles=None,
747 skip_journal_pattern=None,
748 ):
742 """Rolls back the transaction contained in the given file
749 """Rolls back the transaction contained in the given file
743
750
744 Reads the entries in the specified file, and the corresponding
751 Reads the entries in the specified file, and the corresponding
@@ -783,6 +790,9 b' def rollback(opener, vfsmap, file, repor'
783 line = line[:-1]
790 line = line[:-1]
784 l, f, b, c = line.split(b'\0')
791 l, f, b, c = line.split(b'\0')
785 backupentries.append((l, f, b, bool(c)))
792 backupentries.append((l, f, b, bool(c)))
793 if skip_journal_pattern is not None:
794 keep = lambda x: not skip_journal_pattern.match(x[1])
795 backupentries = [x for x in backupentries if keep(x)]
786
796
787 _playback(
797 _playback(
788 file,
798 file,
General Comments 0
You need to be logged in to leave comments. Login now