# HG changeset patch # User Pierre-Yves David # Date 2020-09-15 08:55:17 # Node ID e1f5a2328b76f4d96b159c29634051a5f6505a51 # Parent c005c29f0810f3ddf7ea4c64812e09bd266c49d9 salvaged: persist the salvaged set on disk With the new side data storage, this is trivial. Differential Revision: https://phab.mercurial-scm.org/D9129 diff --git a/mercurial/metadata.py b/mercurial/metadata.py --- a/mercurial/metadata.py +++ b/mercurial/metadata.py @@ -685,7 +685,7 @@ ACTION_MASK = int("111" "00", 2) 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 @@ INDEX_ENTRY = struct.Struct(">bLL") 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 @@ def encode_files_sidedata(files): 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 @@ def decode_files_sidedata(sidedata): 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) diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t --- a/tests/test-copies-chain-merge.t +++ b/tests/test-copies-chain-merge.t @@ -1174,19 +1174,23 @@ We upgrade a repository that is not usin 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