# HG changeset patch # User Mateusz Kwapich # Date 1464219376 25200 # Node ID b6f9934cf10b5deb4e3830e0749aa429a23c35ed # Parent f200b58497f1c1f87517492dfe8cd83501b92c4c dirstate: don't use actualfilename to name the backup file The issue with using actualfilename is that dirstate saved during transaction with "pending" in filename will be impossible to recover from outside of the transaction because the recover method will be looking for the name without "pending". diff -r f200b58497f1 -r b6f9934cf10b mercurial/dirstate.py --- a/mercurial/dirstate.py Sat May 28 12:58:46 2016 -0700 +++ b/mercurial/dirstate.py Wed May 25 16:36:16 2016 -0700 @@ -1230,7 +1230,7 @@ # end of this transaction tr.registertmp(filename, location='plain') - self._opener.write(prefix + filename + suffix, + self._opener.write(prefix + self._filename + suffix, self._opener.tryread(filename)) def restorebackup(self, tr, suffix='', prefix=''): @@ -1239,9 +1239,10 @@ # changes of dirstate out after restoring from backup file self.invalidate() filename = self._actualfilename(tr) - self._opener.rename(prefix + filename + suffix, filename) + # using self._filename to avoid having "pending" in the backup filename + self._opener.rename(prefix + self._filename + suffix, filename) def clearbackup(self, tr, suffix='', prefix=''): '''Clear backup file with suffix''' - filename = self._actualfilename(tr) - self._opener.unlink(prefix + filename + suffix) + # using self._filename to avoid having "pending" in the backup filename + self._opener.unlink(prefix + self._filename + suffix)