D4623: transaction: make undoname a private attribute

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Sep 17 23:36:20 UTC 2018


indygreg created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This attribute tracks the file pattern to use for undo files.
  It is an implementation detail of the current transaction semantics
  and doesn't need to be part of the future transaction interface. So
  mark it as private.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4623

AFFECTED FILES
  mercurial/transaction.py

CHANGE DETAILS

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -132,7 +132,7 @@
         self.entries = []
         self.map = {}
         self.journal = journalname
-        self.undoname = undoname
+        self._undoname = undoname
         self._queue = []
         # A callback to validate transaction content before closing it.
         # should raise exception is anything is wrong.
@@ -532,9 +532,10 @@
 
     def _writeundo(self):
         """write transaction data for possible future undo call"""
-        if self.undoname is None:
+        if self._undoname is None:
             return
-        undobackupfile = self.opener.open("%s.backupfiles" % self.undoname, 'w')
+        undobackupfile = self.opener.open("%s.backupfiles" % self._undoname,
+                                          'w')
         undobackupfile.write('%d\n' % version)
         for l, f, b, c in self._backupentries:
             if not f:  # temporary file
@@ -549,7 +550,7 @@
                 vfs = self._vfsmap[l]
                 base, name = vfs.split(b)
                 assert name.startswith(self.journal), name
-                uname = name.replace(self.journal, self.undoname, 1)
+                uname = name.replace(self.journal, self._undoname, 1)
                 u = vfs.reljoin(base, uname)
                 util.copyfile(vfs.join(b), vfs.join(u), hardlink=True)
             undobackupfile.write("%s\0%s\0%s\0%d\n" % (l, f, u, c))



To: indygreg, #hg-reviewers
Cc: mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list