transaction: make undoname a private attribute
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 17 Sep 2018 15:52:59 -0700
changeset 39675 da9ce63bfa9b
parent 39674 3e8952c0cb45
child 39676 77c4e2ae9f07
transaction: make undoname a private attribute 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. Differential Revision: https://phab.mercurial-scm.org/D4623
mercurial/transaction.py
--- a/mercurial/transaction.py	Mon Sep 17 15:51:19 2018 -0700
+++ b/mercurial/transaction.py	Mon Sep 17 15:52:59 2018 -0700
@@ -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))