Patchwork D9129: salvaged: persist the salvaged set on disk

login
register
mail settings
Submitter phabricator
Date Sept. 30, 2020, 1:11 p.m.
Message ID <differential-rev-PHID-DREV-gqbqrt67ublxvk4dqu5c-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47345/
State Superseded
Headers show

Comments

phabricator - Sept. 30, 2020, 1:11 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  With the new side data storage, this is trivial.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9129

AFFECTED FILES
  mercurial/metadata.py
  tests/test-copies-chain-merge.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -1192,19 +1192,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
diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -684,7 +684,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)
@@ -705,7 +705,7 @@ 
     copied_from_p1 = files.copied_from_p1
     copied_from_p2 = files.copied_from_p2
 
-    all_files = set(touched - salvaged)
+    all_files = set(touched)
     all_files.update(copied_from_p1.values())
     all_files.update(copied_from_p2.values())
     all_files = sorted(all_files)
@@ -725,6 +725,8 @@ 
             flag |= MERGED_FLAG
         elif f in removed:
             flag |= REMOVED_FLAG
+        elif f in salvaged:
+            flag |= SALVAGED_FLAG
         elif f in touched:
             flag |= TOUCHED_FLAG
 
@@ -770,6 +772,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)