##// END OF EJS Templates
dirstate: add prefix and suffix arguments to backup...
Mateusz Kwapich -
r29189:930d4ee4 default
parent child Browse files
Show More
@@ -1207,7 +1207,7 b' class dirstate(object):'
1207 else:
1207 else:
1208 return self._filename
1208 return self._filename
1209
1209
1210 def savebackup(self, tr, suffix):
1210 def savebackup(self, tr, suffix='', prefix=''):
1211 '''Save current dirstate into backup file with suffix'''
1211 '''Save current dirstate into backup file with suffix'''
1212 filename = self._actualfilename(tr)
1212 filename = self._actualfilename(tr)
1213
1213
@@ -1228,17 +1228,18 b' class dirstate(object):'
1228 # end of this transaction
1228 # end of this transaction
1229 tr.registertmp(filename, location='plain')
1229 tr.registertmp(filename, location='plain')
1230
1230
1231 self._opener.write(filename + suffix, self._opener.tryread(filename))
1231 self._opener.write(prefix + filename + suffix,
1232 self._opener.tryread(filename))
1232
1233
1233 def restorebackup(self, tr, suffix):
1234 def restorebackup(self, tr, suffix='', prefix=''):
1234 '''Restore dirstate by backup file with suffix'''
1235 '''Restore dirstate by backup file with suffix'''
1235 # this "invalidate()" prevents "wlock.release()" from writing
1236 # this "invalidate()" prevents "wlock.release()" from writing
1236 # changes of dirstate out after restoring from backup file
1237 # changes of dirstate out after restoring from backup file
1237 self.invalidate()
1238 self.invalidate()
1238 filename = self._actualfilename(tr)
1239 filename = self._actualfilename(tr)
1239 self._opener.rename(filename + suffix, filename)
1240 self._opener.rename(prefix + filename + suffix, filename)
1240
1241
1241 def clearbackup(self, tr, suffix):
1242 def clearbackup(self, tr, suffix='', prefix=''):
1242 '''Clear backup file with suffix'''
1243 '''Clear backup file with suffix'''
1243 filename = self._actualfilename(tr)
1244 filename = self._actualfilename(tr)
1244 self._opener.unlink(filename + suffix)
1245 self._opener.unlink(prefix + filename + suffix)
General Comments 0
You need to be logged in to leave comments. Login now