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).
--- a/mercurial/transaction.py Mon May 15 08:54:33 2023 +0200
+++ b/mercurial/transaction.py Mon May 15 08:54:47 2023 +0200
@@ -409,7 +409,7 @@
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)
--- a/tests/test-fncache.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-fncache.t Mon May 15 08:54:47 2023 +0200
@@ -104,7 +104,7 @@
.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 @@
.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 !)
--- a/tests/test-hardlinks.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-hardlinks.t Mon May 15 08:54:47 2023 +0200
@@ -52,7 +52,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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:
--- a/tests/test-hook.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-hook.t Mon May 15 08:54:47 2023 +0200
@@ -465,7 +465,7 @@
phaseroots
requires
undo
- undo.backup.fncache (repofncache !)
+ undo.backup.fncache.bck (repofncache !)
undo.backupfiles
--- a/tests/test-inherit-mode.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-inherit-mode.t Mon May 15 08:54:47 2023 +0200
@@ -95,7 +95,7 @@
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 @@
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/
--- a/tests/test-largefiles-cache.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-largefiles-cache.t Mon May 15 08:54:47 2023 +0200
@@ -184,7 +184,7 @@
$ 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
--- a/tests/test-persistent-nodemap.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-persistent-nodemap.t Mon May 15 08:54:47 2023 +0200
@@ -1193,8 +1193,6 @@
(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)
--- a/tests/test-rebase-abort.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-rebase-abort.t Mon May 15 08:54:47 2023 +0200
@@ -392,7 +392,6 @@
.hg/dirstate
.hg/merge/state
.hg/rebasestate
- .hg/undo.backup.dirstate
.hg/updatestate
$ hg rebase -s 3 -d tip
--- a/tests/test-rollback.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-rollback.t Mon May 15 08:54:47 2023 +0200
@@ -72,7 +72,7 @@
$ 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
--- a/tests/test-transaction-rollback-on-revlog-split.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-transaction-rollback-on-revlog-split.t Mon May 15 08:54:47 2023 +0200
@@ -172,7 +172,7 @@
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
--- a/tests/test-upgrade-repo.t Mon May 15 08:54:33 2023 +0200
+++ b/tests/test-upgrade-repo.t Mon May 15 08:54:47 2023 +0200
@@ -866,7 +866,7 @@
phaseroots
requires
undo
- undo.backup.fncache
+ undo.backup.fncache.bck
undo.backupfiles
unless --no-backup is passed