# HG changeset patch # User Pierre-Yves David # Date 2023-05-15 06:54:47 # Node ID 63dc24be635d2144538323d88535d6b4e552c668 # Parent a52aae8bcc7ac5d9dfe2c12cd4b433a8e6c8d62d transaction: use a ".bck" extension for all backup file There are too much code in Mercurial that assume file function from extension. Keeping the original extension when doing backup is just creating confusion (for exemple, backup of revlog's confused with new version revlogs). So we change the backup name from now on to be explicilty backup file and prevent this kind of problem. (note that repository using fncache is less affected (but still affected) by this kind of problem as the backup are not listed in the fncache). diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -409,7 +409,7 @@ class transaction(util.transactional): vfs = self._vfsmap[location] dirname, filename = vfs.split(file) - backupfilename = b"%s.backup.%s" % (self._journal, filename) + backupfilename = b"%s.backup.%s.bck" % (self._journal, filename) backupfile = vfs.reljoin(dirname, backupfilename) if vfs.exists(file): filepath = vfs.join(file) diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -104,7 +104,7 @@ Non store repo: .hg/phaseroots .hg/requires .hg/undo - .hg/undo.backup.branch + .hg/undo.backup.branch.bck .hg/undo.backupfiles .hg/undo.desc .hg/wcache @@ -144,7 +144,7 @@ Non fncache repo: .hg/store/requires .hg/store/undo .hg/store/undo.backupfiles - .hg/undo.backup.branch + .hg/undo.backup.branch.bck .hg/undo.desc .hg/wcache .hg/wcache/checkisexec (execbit !) diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -52,7 +52,7 @@ Prepare repo r1: 1 r1/.hg/store/phaseroots 1 r1/.hg/store/requires 1 r1/.hg/store/undo - 1 r1/.hg/store/undo.backup.fncache (repofncache !) + 1 r1/.hg/store/undo.backup.fncache.bck (repofncache !) 1 r1/.hg/store/undo.backupfiles @@ -93,7 +93,7 @@ Repos r1 and r2 should now contain hardl 1 r1/.hg/store/phaseroots 1 r1/.hg/store/requires 1 r1/.hg/store/undo - 1 r1/.hg/store/undo.backup.fncache (repofncache !) + 1 r1/.hg/store/undo.backup.fncache.bck (repofncache !) 1 r1/.hg/store/undo.backupfiles $ nlinksdir r2/.hg/store @@ -252,8 +252,8 @@ r4 has hardlinks in the working dir (not 2 r4/.hg/store/requires 2 r4/.hg/store/undo 2 r4/.hg/store/undo.backupfiles - [24] r4/.hg/undo.backup.branch (re) - 2 r4/\.hg/undo\.backup\.dirstate (re) + [24] r4/.hg/undo.backup.branch.bck (re) + 2 r4/\.hg/undo\.backup\.dirstate.bck (re) 2 r4/.hg/undo.desc 2 r4/.hg/wcache/checkisexec (execbit !) 2 r4/.hg/wcache/checklink-target (symlink !) @@ -266,9 +266,9 @@ r4 has hardlinks in the working dir (not Update back to revision 12 in r4 should break hardlink of file f1 and f3: #if hardlink-whitelisted - $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate + $ nlinksdir r4/.hg/undo.backup.dirstate.bck r4/.hg/dirstate 2 r4/.hg/dirstate - 2 r4/.hg/undo.backup.dirstate + 2 r4/.hg/undo.backup.dirstate.bck #endif @@ -305,8 +305,8 @@ Update back to revision 12 in r4 should 2 r4/.hg/store/requires 2 r4/.hg/store/undo 2 r4/.hg/store/undo.backupfiles - [23] r4/.hg/undo.backup.branch (re) - 2 r4/\.hg/undo\.backup\.dirstate (re) + [23] r4/.hg/undo.backup.branch.bck (re) + 2 r4/\.hg/undo\.backup\.dirstate.bck (re) 2 r4/.hg/undo.desc 2 r4/.hg/wcache/checkisexec (execbit !) 2 r4/.hg/wcache/checklink-target (symlink !) @@ -319,9 +319,9 @@ Update back to revision 12 in r4 should 2 r4/f3 (no-execbit !) #if hardlink-whitelisted - $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate + $ nlinksdir r4/.hg/undo.backup.dirstate.bck r4/.hg/dirstate 1 r4/.hg/dirstate - 2 r4/.hg/undo.backup.dirstate + 2 r4/.hg/undo.backup.dirstate.bck #endif Test hardlinking outside hg: diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -465,7 +465,7 @@ more there after phaseroots requires undo - undo.backup.fncache (repofncache !) + undo.backup.fncache.bck (repofncache !) undo.backupfiles diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t --- a/tests/test-inherit-mode.t +++ b/tests/test-inherit-mode.t @@ -95,7 +95,7 @@ new directories are setgid 00600 ./.hg/store/requires 00660 ./.hg/store/undo 00660 ./.hg/store/undo.backupfiles - 00660 ./.hg/undo.backup.branch + 00660 ./.hg/undo.backup.branch.bck 00660 ./.hg/undo.desc 00770 ./.hg/wcache/ 00711 ./.hg/wcache/checkisexec @@ -153,7 +153,7 @@ group can still write everything 00660 ../push/.hg/store/requires 00660 ../push/.hg/store/undo 00660 ../push/.hg/store/undo.backupfiles - 00660 ../push/.hg/undo.backup.branch + 00660 ../push/.hg/undo.backup.branch.bck 00660 ../push/.hg/undo.desc 00770 ../push/.hg/wcache/ diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t --- a/tests/test-largefiles-cache.t +++ b/tests/test-largefiles-cache.t @@ -184,7 +184,7 @@ conditional above. $ find share_dst/.hg/largefiles/* | sort share_dst/.hg/largefiles/dirstate - share_dst/.hg/largefiles/undo.backup.dirstate + share_dst/.hg/largefiles/undo.backup.dirstate.bck $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort src/.hg/largefiles/dirstate diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -1193,8 +1193,6 @@ Performe the mix of clone and full refre (note: the stream clone code wronly pick the `undo.` files) $ cat clone-output-2 - adding [s] undo.backup.00manifest.n (62 bytes) (known-bad-output !) - adding [s] undo.backup.00changelog.n (62 bytes) (known-bad-output !) adding [s] 00manifest.n (62 bytes) adding [s] 00manifest-*.nd (118 KB) (glob) adding [s] 00changelog.n (62 bytes) diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t --- a/tests/test-rebase-abort.t +++ b/tests/test-rebase-abort.t @@ -392,7 +392,6 @@ New operations are blocked with the corr .hg/dirstate .hg/merge/state .hg/rebasestate - .hg/undo.backup.dirstate .hg/updatestate $ hg rebase -s 3 -d tip diff --git a/tests/test-rollback.t b/tests/test-rollback.t --- a/tests/test-rollback.t +++ b/tests/test-rollback.t @@ -72,7 +72,7 @@ working dir unaffected by rollback: do n $ hg update bar 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (activating bookmark bar) - $ cat .hg/undo.backup.branch + $ cat .hg/undo.backup.branch.bck test $ hg log -G --template '{rev} [{branch}] ({bookmarks}) {desc|firstline}\n' o 2 [test] (foo) add b diff --git a/tests/test-transaction-rollback-on-revlog-split.t b/tests/test-transaction-rollback-on-revlog-split.t --- a/tests/test-transaction-rollback-on-revlog-split.t +++ b/tests/test-transaction-rollback-on-revlog-split.t @@ -172,7 +172,7 @@ A "temporary file" entry exist for the s data/file.i 1174 data/file.d 0 $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep data/file - data/file.i data/journal.backup.file.i 0 + data/file.i data/journal.backup.file.i.bck 0 data/file.i.s 0 recover is rolling the split back, the fncache is still valid diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -866,7 +866,7 @@ old store should be backed up phaseroots requires undo - undo.backup.fncache + undo.backup.fncache.bck undo.backupfiles unless --no-backup is passed