Show More
@@ -131,7 +131,7 b' class transaction(util.transactional):' | |||
|
131 | 131 | self.after = after |
|
132 | 132 | self.entries = [] |
|
133 | 133 | self.map = {} |
|
134 | self.journal = journalname | |
|
134 | self._journal = journalname | |
|
135 | 135 | self._undoname = undoname |
|
136 | 136 | self._queue = [] |
|
137 | 137 | # A callback to validate transaction content before closing it. |
@@ -157,7 +157,7 b' class transaction(util.transactional):' | |||
|
157 | 157 | |
|
158 | 158 | # a dict of arguments to be passed to hooks |
|
159 | 159 | self.hookargs = {} |
|
160 | self.file = opener.open(self.journal, "w") | |
|
160 | self.file = opener.open(self._journal, "w") | |
|
161 | 161 | |
|
162 | 162 | # a list of ('location', 'path', 'backuppath', cache) entries. |
|
163 | 163 | # - if 'backuppath' is empty, no file existed at backup time |
@@ -167,12 +167,12 b' class transaction(util.transactional):' | |||
|
167 | 167 | # (cache is currently unused) |
|
168 | 168 | self._backupentries = [] |
|
169 | 169 | self._backupmap = {} |
|
170 | self._backupjournal = "%s.backupfiles" % self.journal | |
|
170 | self._backupjournal = "%s.backupfiles" % self._journal | |
|
171 | 171 | self._backupsfile = opener.open(self._backupjournal, 'w') |
|
172 | 172 | self._backupsfile.write('%d\n' % version) |
|
173 | 173 | |
|
174 | 174 | if createmode is not None: |
|
175 | opener.chmod(self.journal, createmode & 0o666) | |
|
175 | opener.chmod(self._journal, createmode & 0o666) | |
|
176 | 176 | opener.chmod(self._backupjournal, createmode & 0o666) |
|
177 | 177 | |
|
178 | 178 | # hold file generations to be performed on commit |
@@ -194,7 +194,7 b' class transaction(util.transactional):' | |||
|
194 | 194 | (name, self._count, self._usages)) |
|
195 | 195 | |
|
196 | 196 | def __del__(self): |
|
197 | if self.journal: | |
|
197 | if self._journal: | |
|
198 | 198 | self._abort() |
|
199 | 199 | |
|
200 | 200 | @active |
@@ -255,7 +255,7 b' class transaction(util.transactional):' | |||
|
255 | 255 | return |
|
256 | 256 | vfs = self._vfsmap[location] |
|
257 | 257 | dirname, filename = vfs.split(file) |
|
258 | backupfilename = "%s.backup.%s" % (self.journal, filename) | |
|
258 | backupfilename = "%s.backup.%s" % (self._journal, filename) | |
|
259 | 259 | backupfile = vfs.reljoin(dirname, backupfilename) |
|
260 | 260 | if vfs.exists(file): |
|
261 | 261 | filepath = vfs.join(file) |
@@ -493,8 +493,8 b' class transaction(util.transactional):' | |||
|
493 | 493 | self.after = None # Help prevent cycles. |
|
494 | 494 | if self.opener.isfile(self._backupjournal): |
|
495 | 495 | self.opener.unlink(self._backupjournal) |
|
496 | if self.opener.isfile(self.journal): | |
|
497 | self.opener.unlink(self.journal) | |
|
496 | if self.opener.isfile(self._journal): | |
|
497 | self.opener.unlink(self._journal) | |
|
498 | 498 | for l, _f, b, c in self._backupentries: |
|
499 | 499 | if l not in self._vfsmap and c: |
|
500 | 500 | self.report("couldn't remove %s: unknown cache location" |
@@ -511,7 +511,7 b' class transaction(util.transactional):' | |||
|
511 | 511 | self.report("couldn't remove %s: %s\n" |
|
512 | 512 | % (vfs.join(b), inst)) |
|
513 | 513 | self._backupentries = [] |
|
514 | self.journal = None | |
|
514 | self._journal = None | |
|
515 | 515 | |
|
516 | 516 | self.releasefn(self, True) # notify success of closing transaction |
|
517 | 517 | self.releasefn = None # Help prevent cycles. |
@@ -549,8 +549,8 b' class transaction(util.transactional):' | |||
|
549 | 549 | continue |
|
550 | 550 | vfs = self._vfsmap[l] |
|
551 | 551 | base, name = vfs.split(b) |
|
552 | assert name.startswith(self.journal), name | |
|
553 | uname = name.replace(self.journal, self._undoname, 1) | |
|
552 | assert name.startswith(self._journal), name | |
|
553 | uname = name.replace(self._journal, self._undoname, 1) | |
|
554 | 554 | u = vfs.reljoin(base, uname) |
|
555 | 555 | util.copyfile(vfs.join(b), vfs.join(u), hardlink=True) |
|
556 | 556 | undobackupfile.write("%s\0%s\0%s\0%d\n" % (l, f, u, c)) |
@@ -567,8 +567,8 b' class transaction(util.transactional):' | |||
|
567 | 567 | if not self.entries and not self._backupentries: |
|
568 | 568 | if self._backupjournal: |
|
569 | 569 | self.opener.unlink(self._backupjournal) |
|
570 | if self.journal: | |
|
571 | self.opener.unlink(self.journal) | |
|
570 | if self._journal: | |
|
571 | self.opener.unlink(self._journal) | |
|
572 | 572 | return |
|
573 | 573 | |
|
574 | 574 | self.report(_("transaction abort!\n")) |
@@ -578,14 +578,14 b' class transaction(util.transactional):' | |||
|
578 | 578 | self._abortcallback[cat](self) |
|
579 | 579 | # Prevent double usage and help clear cycles. |
|
580 | 580 | self._abortcallback = None |
|
581 | _playback(self.journal, self.report, self.opener, self._vfsmap, | |
|
581 | _playback(self._journal, self.report, self.opener, self._vfsmap, | |
|
582 | 582 | self.entries, self._backupentries, False, |
|
583 | 583 | checkambigfiles=self.checkambigfiles) |
|
584 | 584 | self.report(_("rollback completed\n")) |
|
585 | 585 | except BaseException: |
|
586 | 586 | self.report(_("rollback failed - please run hg recover\n")) |
|
587 | 587 | finally: |
|
588 | self.journal = None | |
|
588 | self._journal = None | |
|
589 | 589 | self.releasefn(self, False) # notify failure of transaction |
|
590 | 590 | self.releasefn = None # Help prevent cycles. |
|
591 | 591 |
General Comments 0
You need to be logged in to leave comments.
Login now