D1201: dirstate: clean up when restoring identical backups
mbthomas (Mark Thomas)
phabricator at mercurial-scm.org
Mon Oct 30 21:30:57 UTC 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc2b30348930f: dirstate: clean up when restoring identical backups (authored by mbthomas, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D1201?vs=3048&id=3159
REVISION DETAIL
https://phab.mercurial-scm.org/D1201
AFFECTED FILES
mercurial/dirstate.py
tests/test-dirstate-backup.t
CHANGE DETAILS
diff --git a/tests/test-dirstate-backup.t b/tests/test-dirstate-backup.t
--- a/tests/test-dirstate-backup.t
+++ b/tests/test-dirstate-backup.t
@@ -11,9 +11,8 @@
abort: stdin: no diffs found
[255]
-A dirstate backup is left behind
+No dirstate backups are left behind
$ ls .hg/dirstate* | sort
.hg/dirstate
- .hg/dirstate.backup.import.* (glob)
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1187,7 +1187,11 @@
# changes of dirstate out after restoring from backup file
self.invalidate()
filename = self._actualfilename(tr)
- self._opener.rename(backupname, filename, checkambig=True)
+ o = self._opener
+ if util.samefile(o.join(backupname), o.join(filename)):
+ o.unlink(backupname)
+ else:
+ o.rename(backupname, filename, checkambig=True)
def clearbackup(self, tr, backupname):
'''Clear backup file'''
To: mbthomas, #hg-reviewers, krbullock, durham, durin42
Cc: durin42, martinvonz, krbullock, durham, mercurial-devel
More information about the Mercurial-devel
mailing list