##// END OF EJS Templates
transaction: make opener a private attribute...
Gregory Szorc -
r39718:b590f476 default
parent child Browse files
Show More
@@ -123,7 +123,7 b' class transaction(util.transactional):'
123 self._usages = 1
123 self._usages = 1
124 self.report = report
124 self.report = report
125 # a vfs to the store content
125 # a vfs to the store content
126 self.opener = opener
126 self._opener = opener
127 # a map to access file in various {location -> vfs}
127 # a map to access file in various {location -> vfs}
128 vfsmap = vfsmap.copy()
128 vfsmap = vfsmap.copy()
129 vfsmap[''] = opener # set default value
129 vfsmap[''] = opener # set default value
@@ -491,10 +491,10 b' class transaction(util.transactional):'
491 if self._after:
491 if self._after:
492 self._after()
492 self._after()
493 self._after = None # Help prevent cycles.
493 self._after = None # Help prevent cycles.
494 if self.opener.isfile(self._backupjournal):
494 if self._opener.isfile(self._backupjournal):
495 self.opener.unlink(self._backupjournal)
495 self._opener.unlink(self._backupjournal)
496 if self.opener.isfile(self._journal):
496 if self._opener.isfile(self._journal):
497 self.opener.unlink(self._journal)
497 self._opener.unlink(self._journal)
498 for l, _f, b, c in self._backupentries:
498 for l, _f, b, c in self._backupentries:
499 if l not in self._vfsmap and c:
499 if l not in self._vfsmap and c:
500 self.report("couldn't remove %s: unknown cache location"
500 self.report("couldn't remove %s: unknown cache location"
@@ -534,8 +534,8 b' class transaction(util.transactional):'
534 """write transaction data for possible future undo call"""
534 """write transaction data for possible future undo call"""
535 if self._undoname is None:
535 if self._undoname is None:
536 return
536 return
537 undobackupfile = self.opener.open("%s.backupfiles" % self._undoname,
537 undobackupfile = self._opener.open("%s.backupfiles" % self._undoname,
538 'w')
538 'w')
539 undobackupfile.write('%d\n' % version)
539 undobackupfile.write('%d\n' % version)
540 for l, f, b, c in self._backupentries:
540 for l, f, b, c in self._backupentries:
541 if not f: # temporary file
541 if not f: # temporary file
@@ -566,9 +566,9 b' class transaction(util.transactional):'
566 try:
566 try:
567 if not self.entries and not self._backupentries:
567 if not self.entries and not self._backupentries:
568 if self._backupjournal:
568 if self._backupjournal:
569 self.opener.unlink(self._backupjournal)
569 self._opener.unlink(self._backupjournal)
570 if self._journal:
570 if self._journal:
571 self.opener.unlink(self._journal)
571 self._opener.unlink(self._journal)
572 return
572 return
573
573
574 self.report(_("transaction abort!\n"))
574 self.report(_("transaction abort!\n"))
@@ -578,9 +578,9 b' class transaction(util.transactional):'
578 self._abortcallback[cat](self)
578 self._abortcallback[cat](self)
579 # Prevent double usage and help clear cycles.
579 # Prevent double usage and help clear cycles.
580 self._abortcallback = None
580 self._abortcallback = None
581 _playback(self._journal, self.report, self.opener, self._vfsmap,
581 _playback(self._journal, self.report, self._opener,
582 self.entries, self._backupentries, False,
582 self._vfsmap, self.entries, self._backupentries,
583 checkambigfiles=self._checkambigfiles)
583 False, checkambigfiles=self._checkambigfiles)
584 self.report(_("rollback completed\n"))
584 self.report(_("rollback completed\n"))
585 except BaseException:
585 except BaseException:
586 self.report(_("rollback failed - please run hg recover\n"))
586 self.report(_("rollback failed - please run hg recover\n"))
General Comments 0
You need to be logged in to leave comments. Login now