##// END OF EJS Templates
dirstate: make backup methods public...
Mateusz Kwapich -
r29137:d115cbf5 default
parent child Browse files
Show More
@@ -3518,7 +3518,7 b' class dirstateguard(object):'
3518 def __init__(self, repo, name):
3518 def __init__(self, repo, name):
3519 self._repo = repo
3519 self._repo = repo
3520 self._suffix = '.backup.%s.%d' % (name, id(self))
3520 self._suffix = '.backup.%s.%d' % (name, id(self))
3521 repo.dirstate._savebackup(repo.currenttransaction(), self._suffix)
3521 repo.dirstate.savebackup(repo.currenttransaction(), self._suffix)
3522 self._active = True
3522 self._active = True
3523 self._closed = False
3523 self._closed = False
3524
3524
@@ -3536,13 +3536,13 b' class dirstateguard(object):'
3536 % self._suffix)
3536 % self._suffix)
3537 raise error.Abort(msg)
3537 raise error.Abort(msg)
3538
3538
3539 self._repo.dirstate._clearbackup(self._repo.currenttransaction(),
3539 self._repo.dirstate.clearbackup(self._repo.currenttransaction(),
3540 self._suffix)
3540 self._suffix)
3541 self._active = False
3541 self._active = False
3542 self._closed = True
3542 self._closed = True
3543
3543
3544 def _abort(self):
3544 def _abort(self):
3545 self._repo.dirstate._restorebackup(self._repo.currenttransaction(),
3545 self._repo.dirstate.restorebackup(self._repo.currenttransaction(),
3546 self._suffix)
3546 self._suffix)
3547 self._active = False
3547 self._active = False
3548
3548
@@ -1205,7 +1205,7 b' class dirstate(object):'
1205 else:
1205 else:
1206 return self._filename
1206 return self._filename
1207
1207
1208 def _savebackup(self, tr, suffix):
1208 def savebackup(self, tr, suffix):
1209 '''Save current dirstate into backup file with suffix'''
1209 '''Save current dirstate into backup file with suffix'''
1210 filename = self._actualfilename(tr)
1210 filename = self._actualfilename(tr)
1211
1211
@@ -1228,7 +1228,7 b' class dirstate(object):'
1228
1228
1229 self._opener.write(filename + suffix, self._opener.tryread(filename))
1229 self._opener.write(filename + suffix, self._opener.tryread(filename))
1230
1230
1231 def _restorebackup(self, tr, suffix):
1231 def restorebackup(self, tr, suffix):
1232 '''Restore dirstate by backup file with suffix'''
1232 '''Restore dirstate by backup file with suffix'''
1233 # this "invalidate()" prevents "wlock.release()" from writing
1233 # this "invalidate()" prevents "wlock.release()" from writing
1234 # changes of dirstate out after restoring from backup file
1234 # changes of dirstate out after restoring from backup file
@@ -1236,7 +1236,7 b' class dirstate(object):'
1236 filename = self._actualfilename(tr)
1236 filename = self._actualfilename(tr)
1237 self._opener.rename(filename + suffix, filename)
1237 self._opener.rename(filename + suffix, filename)
1238
1238
1239 def _clearbackup(self, tr, suffix):
1239 def clearbackup(self, tr, suffix):
1240 '''Clear backup file with suffix'''
1240 '''Clear backup file with suffix'''
1241 filename = self._actualfilename(tr)
1241 filename = self._actualfilename(tr)
1242 self._opener.unlink(filename + suffix)
1242 self._opener.unlink(filename + suffix)
General Comments 0
You need to be logged in to leave comments. Login now