mercurial/transaction.py
changeset 50070 c8f32aa80dca
parent 49995 27fd12eca557
child 50195 11e6eee4b063
equal deleted inserted replaced
50069:81870c92c293 50070:c8f32aa80dca
   736 BAD_VERSION_MSG = _(
   736 BAD_VERSION_MSG = _(
   737     b"journal was created by a different version of Mercurial\n"
   737     b"journal was created by a different version of Mercurial\n"
   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
   745     '*.backupfiles' file, to recover from an incomplete transaction.
   752     '*.backupfiles' file, to recover from an incomplete transaction.
   746 
   753 
   781                     if line:
   788                     if line:
   782                         # Shave off the trailing newline
   789                         # Shave off the trailing newline
   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,
   789         report,
   799         report,
   790         opener,
   800         opener,