##// END OF EJS Templates
transaction: make file a private attribute...
Gregory Szorc -
r39713:d27fde3e default
parent child Browse files
Show More
@@ -157,7 +157,7 b' class transaction(util.transactional):'
157
157
158 # a dict of arguments to be passed to hooks
158 # a dict of arguments to be passed to hooks
159 self.hookargs = {}
159 self.hookargs = {}
160 self.file = opener.open(self._journal, "w")
160 self._file = opener.open(self._journal, "w")
161
161
162 # a list of ('location', 'path', 'backuppath', cache) entries.
162 # a list of ('location', 'path', 'backuppath', cache) entries.
163 # - if 'backuppath' is empty, no file existed at backup time
163 # - if 'backuppath' is empty, no file existed at backup time
@@ -233,8 +233,8 b' class transaction(util.transactional):'
233 self.entries.append((file, offset, data))
233 self.entries.append((file, offset, data))
234 self.map[file] = len(self.entries) - 1
234 self.map[file] = len(self.entries) - 1
235 # add enough data to the journal to do the truncate
235 # add enough data to the journal to do the truncate
236 self.file.write("%s\0%d\n" % (file, offset))
236 self._file.write("%s\0%d\n" % (file, offset))
237 self.file.flush()
237 self._file.flush()
238
238
239 @active
239 @active
240 def addbackup(self, file, hardlink=True, location=''):
240 def addbackup(self, file, hardlink=True, location=''):
@@ -368,8 +368,8 b' class transaction(util.transactional):'
368 raise KeyError(file)
368 raise KeyError(file)
369 index = self.map[file]
369 index = self.map[file]
370 self.entries[index] = (file, offset, data)
370 self.entries[index] = (file, offset, data)
371 self.file.write("%s\0%d\n" % (file, offset))
371 self._file.write("%s\0%d\n" % (file, offset))
372 self.file.flush()
372 self._file.flush()
373
373
374 @active
374 @active
375 def nest(self, name=r'<unnamed>'):
375 def nest(self, name=r'<unnamed>'):
@@ -468,7 +468,7 b' class transaction(util.transactional):'
468 self._count -= 1
468 self._count -= 1
469 if self._count != 0:
469 if self._count != 0:
470 return
470 return
471 self.file.close()
471 self._file.close()
472 self._backupsfile.close()
472 self._backupsfile.close()
473 # cleanup temporary files
473 # cleanup temporary files
474 for l, f, b, c in self._backupentries:
474 for l, f, b, c in self._backupentries:
@@ -560,7 +560,7 b' class transaction(util.transactional):'
560 def _abort(self):
560 def _abort(self):
561 self._count = 0
561 self._count = 0
562 self._usages = 0
562 self._usages = 0
563 self.file.close()
563 self._file.close()
564 self._backupsfile.close()
564 self._backupsfile.close()
565
565
566 try:
566 try:
General Comments 0
You need to be logged in to leave comments. Login now