comparison mercurial/transaction.py @ 50694:a41eeb877d07

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 18 Jun 2023 00:09:39 +0200
parents 05d429fe84ed
children 0a4efb650b3e 5c3d07950bac
comparison
equal deleted inserted replaced
50693:b9a355763e76 50694:a41eeb877d07
288 self._backupentries = [] 288 self._backupentries = []
289 self._backupmap = {} 289 self._backupmap = {}
290 self._backupjournal = b"%s.backupfiles" % self._journal 290 self._backupjournal = b"%s.backupfiles" % self._journal
291 self._backupsfile = opener.open(self._backupjournal, b'w') 291 self._backupsfile = opener.open(self._backupjournal, b'w')
292 self._backupsfile.write(b'%d\n' % version) 292 self._backupsfile.write(b'%d\n' % version)
293 # the set of temporary files
294 self._tmp_files = set()
293 295
294 if createmode is not None: 296 if createmode is not None:
295 opener.chmod(self._journal, createmode & 0o666) 297 opener.chmod(self._journal, createmode & 0o666)
296 opener.chmod(self._backupjournal, createmode & 0o666) 298 opener.chmod(self._backupjournal, createmode & 0o666)
297 299
352 """record the state of an append-only file before update""" 354 """record the state of an append-only file before update"""
353 if ( 355 if (
354 file in self._newfiles 356 file in self._newfiles
355 or file in self._offsetmap 357 or file in self._offsetmap
356 or file in self._backupmap 358 or file in self._backupmap
359 or file in self._tmp_files
357 ): 360 ):
358 return 361 return
359 if self._queue: 362 if self._queue:
360 self._queue[-1].append((file, offset)) 363 self._queue[-1].append((file, offset))
361 return 364 return
366 """add a append-only entry to memory and on-disk state""" 369 """add a append-only entry to memory and on-disk state"""
367 if ( 370 if (
368 file in self._newfiles 371 file in self._newfiles
369 or file in self._offsetmap 372 or file in self._offsetmap
370 or file in self._backupmap 373 or file in self._backupmap
374 or file in self._tmp_files
371 ): 375 ):
372 return 376 return
373 if offset: 377 if offset:
374 self._offsetmap[file] = offset 378 self._offsetmap[file] = offset
375 else: 379 else:
437 """register a temporary transaction file 441 """register a temporary transaction file
438 442
439 Such files will be deleted when the transaction exits (on both 443 Such files will be deleted when the transaction exits (on both
440 failure and success). 444 failure and success).
441 """ 445 """
446 self._tmp_files.add(tmpfile)
442 self._addbackupentry((location, b'', tmpfile, False)) 447 self._addbackupentry((location, b'', tmpfile, False))
443 448
444 @active 449 @active
445 def addfilegenerator( 450 def addfilegenerator(
446 self, 451 self,