dirstate: make backup methods public
authorMateusz Kwapich <mitrandir@fb.com>
Thu, 05 May 2016 17:06:54 -0700
changeset 29137 d115cbf5980b
parent 29136 e05bdc01505f
child 29138 a29f071751df
dirstate: make backup methods public They are called from outside of dirstate anyway and I want the localrepo to use them too.
mercurial/cmdutil.py
mercurial/dirstate.py
--- a/mercurial/cmdutil.py	Fri May 06 08:45:56 2016 -0500
+++ b/mercurial/cmdutil.py	Thu May 05 17:06:54 2016 -0700
@@ -3518,7 +3518,7 @@
     def __init__(self, repo, name):
         self._repo = repo
         self._suffix = '.backup.%s.%d' % (name, id(self))
-        repo.dirstate._savebackup(repo.currenttransaction(), self._suffix)
+        repo.dirstate.savebackup(repo.currenttransaction(), self._suffix)
         self._active = True
         self._closed = False
 
@@ -3536,13 +3536,13 @@
                    % self._suffix)
             raise error.Abort(msg)
 
-        self._repo.dirstate._clearbackup(self._repo.currenttransaction(),
+        self._repo.dirstate.clearbackup(self._repo.currenttransaction(),
                                          self._suffix)
         self._active = False
         self._closed = True
 
     def _abort(self):
-        self._repo.dirstate._restorebackup(self._repo.currenttransaction(),
+        self._repo.dirstate.restorebackup(self._repo.currenttransaction(),
                                            self._suffix)
         self._active = False
 
--- a/mercurial/dirstate.py	Fri May 06 08:45:56 2016 -0500
+++ b/mercurial/dirstate.py	Thu May 05 17:06:54 2016 -0700
@@ -1205,7 +1205,7 @@
         else:
             return self._filename
 
-    def _savebackup(self, tr, suffix):
+    def savebackup(self, tr, suffix):
         '''Save current dirstate into backup file with suffix'''
         filename = self._actualfilename(tr)
 
@@ -1228,7 +1228,7 @@
 
         self._opener.write(filename + suffix, self._opener.tryread(filename))
 
-    def _restorebackup(self, tr, suffix):
+    def restorebackup(self, tr, suffix):
         '''Restore dirstate by backup file with suffix'''
         # this "invalidate()" prevents "wlock.release()" from writing
         # changes of dirstate out after restoring from backup file
@@ -1236,7 +1236,7 @@
         filename = self._actualfilename(tr)
         self._opener.rename(filename + suffix, filename)
 
-    def _clearbackup(self, tr, suffix):
+    def clearbackup(self, tr, suffix):
         '''Clear backup file with suffix'''
         filename = self._actualfilename(tr)
         self._opener.unlink(filename + suffix)