salvaged: persist the salvaged set on disk
With the new side data storage, this is trivial.
Differential Revision: https://phab.mercurial-scm.org/D9129
--- a/mercurial/metadata.py Tue Sep 29 22:47:54 2020 +0200
+++ b/mercurial/metadata.py Tue Sep 15 10:55:17 2020 +0200
@@ -685,7 +685,7 @@
ADDED_FLAG = int("001" "00", 2)
MERGED_FLAG = int("010" "00", 2)
REMOVED_FLAG = int("011" "00", 2)
-# `100` is reserved for future use
+SALVAGED_FLAG = int("100" "00", 2)
TOUCHED_FLAG = int("101" "00", 2)
COPIED_MASK = int("11", 2)
@@ -698,7 +698,7 @@
def encode_files_sidedata(files):
- all_files = set(files.touched - files.salvaged)
+ all_files = set(files.touched)
all_files.update(files.copied_from_p1.values())
all_files.update(files.copied_from_p2.values())
all_files = sorted(all_files)
@@ -718,6 +718,8 @@
flag |= MERGED_FLAG
elif f in files.removed:
flag |= REMOVED_FLAG
+ elif f in files.salvaged:
+ flag |= SALVAGED_FLAG
elif f in files.touched:
flag |= TOUCHED_FLAG
@@ -768,6 +770,8 @@
md.mark_merged(filename)
elif flag & ACTION_MASK == REMOVED_FLAG:
md.mark_removed(filename)
+ elif flag & ACTION_MASK == SALVAGED_FLAG:
+ md.mark_salvaged(filename)
elif flag & ACTION_MASK == TOUCHED_FLAG:
md.mark_touched(filename)
--- a/tests/test-copies-chain-merge.t Tue Sep 29 22:47:54 2020 +0200
+++ b/tests/test-copies-chain-merge.t Tue Sep 15 10:55:17 2020 +0200
@@ -1174,19 +1174,23 @@
merged : d, ;
##### revision 30 #####
1 sidedata entries
- entry-0014 size 4
- '\x00\x00\x00\x00'
+ entry-0014 size 14
+ '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
+ salvaged : d, ;
##### revision 31 #####
1 sidedata entries
- entry-0014 size 4
- '\x00\x00\x00\x00'
+ entry-0014 size 14
+ '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
+ salvaged : d, ;
##### revision 32 #####
1 sidedata entries
- entry-0014 size 4
- '\x00\x00\x00\x00'
+ entry-0014 size 14
+ '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
+ salvaged : d, ;
##### revision 33 #####
1 sidedata entries
- entry-0014 size 4
- '\x00\x00\x00\x00'
+ entry-0014 size 14
+ '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
+ salvaged : d, ;
#endif