--- a/mercurial/localrepo.py Thu Feb 16 00:26:24 2023 +0100
+++ b/mercurial/localrepo.py Thu Feb 16 10:00:59 2023 +0100
@@ -10,6 +10,7 @@
import functools
import os
import random
+import re
import sys
import time
import weakref
@@ -100,6 +101,8 @@
urlerr = util.urlerr
urlreq = util.urlreq
+RE_SKIP_DIRSTATE_ROLLBACK = re.compile(b"^(dirstate|narrowspec.dirstate).*")
+
# set of (path, vfs-location) tuples. vfs-location is:
# - 'plain for vfs relative paths
# - '' for svfs relative paths
@@ -2748,8 +2751,16 @@
self.destroying()
vfsmap = {b'plain': self.vfs, b'': self.svfs}
+ skip_journal_pattern = None
+ if not parentgone:
+ skip_journal_pattern = RE_SKIP_DIRSTATE_ROLLBACK
transaction.rollback(
- self.svfs, vfsmap, b'undo', ui.warn, checkambigfiles=_cachedfiles
+ self.svfs,
+ vfsmap,
+ b'undo',
+ ui.warn,
+ checkambigfiles=_cachedfiles,
+ skip_journal_pattern=skip_journal_pattern,
)
bookmarksvfs = bookmarks.bookmarksvfs(self)
if bookmarksvfs.exists(b'undo.bookmarks'):