Patchwork D9610: copies-test: add test chaining multiple merge

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2020, 9:07 a.m.
Message ID <differential-rev-PHID-DREV-yb5o56dxj2clik7xyquz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47908/
State Superseded
Headers show

Comments

phabricator - Dec. 15, 2020, 9:07 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Right now, the copy tracing logic take the right decision for merges, but it
  does not keep track of the right information about these decision and can fall
  into later traps. We start with highlighting this possibility by adding new
  tests, and we will fix them later.
  
  Check the inline test documentation for details.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  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
@@ -738,6 +738,89 @@ 
   o  0 i-0 initial commit: a b h
   
 
+Subcase: chaining salvage information during a merge
+````````````````````````````````````````````````````
+
+We add more change on the branch were the file was deleted. merging again
+should preserve the fact eh file was salvaged.
+
+(creating the change)
+
+  $ hg up 'desc("c-1")'
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo l > unrelated-l
+  $ hg add unrelated-l
+  $ hg ci -m 'l-1: unrelated changes (based on "c" changes)'
+  created new head
+
+(Merge variant 1)
+
+  $ hg up 'desc("mBC-revert-m")'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("l-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mBC+revert,Lm: simple merge'
+
+(Merge variant 2)
+
+  $ hg up 'desc("mCB-revert-m")'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("l-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mCB+revert,Lm: simple merge'
+
+(Merge variant 3)
+
+  $ hg up 'desc("l-1")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg merge 'desc("mBC-revert-m")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mL,BC+revertm: simple merge'
+  created new head
+
+(Merge variant 4)
+
+  $ hg up 'desc("l-1")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg merge 'desc("mCB-revert-m")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mL,CB+revertm: simple merge'
+  created new head
+
+  $ hg log -G --rev '::(desc("mBC+revert,Lm") + desc("mCB+revert,Lm") + desc("mL,BC+revertm") + desc("mL,CB+revertm"))'
+  @    47 mL,CB+revertm: simple merge
+  |\
+  | | o  46 mL,BC+revertm: simple merge
+  | |/|
+  +-+---o  45 mCB+revert,Lm: simple merge
+  | | |
+  | +---o  44 mBC+revert,Lm: simple merge
+  | | |/
+  | o |  43 l-1: unrelated changes (based on "c" changes)
+  | | |
+  | | o  33 mBC-revert-m-0
+  | |/|
+  o---+  32 mCB-revert-m-0
+  |/ /
+  o |  6 c-1 delete d
+  | |
+  | o  5 b-1: b update
+  |/
+  o  2 i-2: c -move-> d
+  |
+  o  1 i-1: a -move-> c
+  |
+  o  0 i-0 initial commit: a b h
+  
+
+
+
 
 Summary of all created cases
 ----------------------------
@@ -764,15 +847,18 @@ 
   i-2: c -move-> d
   j-1: unrelated changes (based on the "a" series of changes)
   k-1: unrelated changes (based on "e" changes)
+  l-1: unrelated changes (based on "c" changes)
   mABm-0 simple merge - the other way
   mAE,Km: simple merge
   mAEm-0 simple merge - one way
   mBAm-0 simple merge - one way
+  mBC+revert,Lm: simple merge
   mBC-revert-m-0
   mBCm-0 simple merge - one way
   mBCm-1 re-add d
   mBDm-0 simple merge - one way
   mBFm-0 simple merge - one way
+  mCB+revert,Lm: simple merge
   mCB-revert-m-0
   mCBm-0 simple merge - the other way
   mCBm-1 re-add d
@@ -790,6 +876,8 @@ 
   mHC-delete-before-conflict-m-0
   mJ,EAm: simple merge
   mK,AEm: simple merge
+  mL,BC+revertm: simple merge
+  mL,CB+revertm: simple merge
 
 
 Test that sidedata computations during upgrades are correct
@@ -1053,6 +1141,27 @@ 
   1 sidedata entries
    entry-0014 size 4
     '\x00\x00\x00\x00'
+  ##### revision 43 #####
+  1 sidedata entries
+   entry-0014 size 24
+    '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-l'
+  added      : unrelated-l, ;
+  ##### revision 44 #####
+  1 sidedata entries
+   entry-0014 size 4
+    '\x00\x00\x00\x00'
+  ##### revision 45 #####
+  1 sidedata entries
+   entry-0014 size 4
+    '\x00\x00\x00\x00'
+  ##### revision 46 #####
+  1 sidedata entries
+   entry-0014 size 4
+    '\x00\x00\x00\x00'
+  ##### revision 47 #####
+  1 sidedata entries
+   entry-0014 size 4
+    '\x00\x00\x00\x00'
 
 #endif
 
@@ -1941,3 +2050,61 @@ 
     a (known-bad-output upgraded !)
 
 
+Subcase: chaining salvage information during a merge
+````````````````````````````````````````````````````
+
+We add more change on the branch were the file was deleted. merging again
+should preserve the fact eh file was salvaged.
+
+reference output:
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB-revert-m-0")'
+  M b
+  A d
+    a (filelog !)
+    a (sidedata !)
+    a (upgraded !)
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC-revert-m-0")'
+  M b
+  A d
+    a (filelog !)
+    a (sidedata !)
+    a (upgraded !)
+  R a
+
+chained output
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC+revert,Lm")'
+  M b
+  A d
+    a (filelog !)
+    a (missing-correct-output sidedata !)
+    a (missing-correct-output upgraded !)
+  A unrelated-l
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB+revert,Lm")'
+  M b
+  A d
+    a (filelog !)
+    a (missing-correct-output sidedata !)
+    a (missing-correct-output upgraded !)
+  A unrelated-l
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mL,BC+revertm")'
+  M b
+  A d
+    a (filelog !)
+    a (missing-correct-output sidedata !)
+    a (missing-correct-output upgraded !)
+  A unrelated-l
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mL,CB+revertm")'
+  M b
+  A d
+    a (filelog !)
+    a (missing-correct-output sidedata !)
+    a (missing-correct-output upgraded !)
+  A unrelated-l
+  R a
+