mercurial/transaction.py
changeset 50070 c8f32aa80dca
parent 49995 27fd12eca557
child 50195 11e6eee4b063
--- a/mercurial/transaction.py	Thu Feb 16 00:26:24 2023 +0100
+++ b/mercurial/transaction.py	Thu Feb 16 10:00:59 2023 +0100
@@ -738,7 +738,14 @@
 )
 
 
-def rollback(opener, vfsmap, file, report, checkambigfiles=None):
+def rollback(
+    opener,
+    vfsmap,
+    file,
+    report,
+    checkambigfiles=None,
+    skip_journal_pattern=None,
+):
     """Rolls back the transaction contained in the given file
 
     Reads the entries in the specified file, and the corresponding
@@ -783,6 +790,9 @@
                         line = line[:-1]
                         l, f, b, c = line.split(b'\0')
                         backupentries.append((l, f, b, bool(c)))
+    if skip_journal_pattern is not None:
+        keep = lambda x: not skip_journal_pattern.match(x[1])
+        backupentries = [x for x in backupentries if keep(x)]
 
     _playback(
         file,