Patchwork D8242: copies-tests: add a case where with merge with an overwritten files

login
register
mail settings
Submitter phabricator
Date March 6, 2020, 10:21 a.m.
Message ID <0dd5ddbfd2892cf78523dfe3d474216a@localhost.localdomain>
Download mbox | patch
Permalink /patch/45544/
State Not Applicable
Headers show

Comments

phabricator - March 6, 2020, 10:21 a.m.
marmoute updated this revision to Diff 20549.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8242?vs=20532&id=20549

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8242/new/

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

AFFECTED FILES
  tests/test-copies-chain-merge.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: 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
@@ -388,40 +388,80 @@ 
   o  0 i-0 initial commit: a b]
   
 
+Merge:
+- one with change to a file (d)
+- one overwriting that file with a rename (from h to i, to d)
+
+  $ hg up 'desc("f-2")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge 'desc("g-1")' --tool :union
+  merging d
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mFGm-0 simple merge - one way'
+  created new head
+  $ hg up 'desc("g-1")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("f-2")' --tool :union
+  merging d
+  0 files updated, 1 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mGFm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mGFm")+desc("mGFm"))'
+  @    29 mGFm-0 simple merge - the other way]
+  |\
+  | o  25 g-1]
+  | |
+  o |  22 f-2: rename i -> d]
+  | |
+  o |  21 f-1: rename h -> i]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b]
+  
+
 
 final summary
 
   $ hg update null --quiet
   $ hg log -G
-  o    27 mGDm-0 simple merge - the other way]
+  o    29 mGFm-0 simple merge - the other way]
   |\
-  +---o  26 mDGm-0 simple merge - one way]
+  +---o  28 mFGm-0 simple merge - one way]
   | |/
-  | o  25 g-1]
-  | |
-  | | o    24 mFBm-0 simple merge - the other way]
-  | | |\
-  | | +---o  23 mBFm-0 simple merge - one way]
+  | | o  27 mGDm-0 simple merge - the other way]
+  | |/|
+  | +---o  26 mDGm-0 simple merge - one way]
+  | | |/
+  | o |  25 g-1]
+  | | |
+  +-----o  24 mFBm-0 simple merge - the other way]
+  | | | |
+  +-------o  23 mBFm-0 simple merge - one way]
   | | | |/
-  | | | o  22 f-2: rename i -> d]
+  o | | |  22 f-2: rename i -> d]
   | | | |
-  | +---o  21 f-1: rename h -> i]
-  | | |
+  o | | |  21 f-1: rename h -> i]
+  |/ / /
   | | | o    20 mEAm-0 simple merge - the other way]
   | | | |\
   | | | +---o  19 mAEm-0 simple merge - one way]
   | | | | |/
   | | | | o  18 e-2 g -move-> f]
   | | | | |
-  | +-----o  17 e-1 b -move-> g]
+  +-------o  17 e-1 b -move-> g]
   | | | |
-  +---+---o  16 mDBm-0 simple merge - the other way]
+  | +-+---o  16 mDBm-0 simple merge - the other way]
   | | | |
-  +---+---o  15 mBDm-0 simple merge - one way]
+  | +-+---o  15 mBDm-0 simple merge - one way]
   | | | |
-  o | | |  14 d-2 re-add d]
+  | o | |  14 d-2 re-add d]
   | | | |
-  o | | |  13 d-1 delete d]
+  | o | |  13 d-1 delete d]
   |/ / /
   | | | o  12 mCBm-1 re-add d]
   | | | |
@@ -604,6 +644,7 @@ 
        5      25 7bded9d9da1f 01c2f5eabdc4 000000000000
        6      26 f04cac32d703 b004912a8510 7bded9d9da1f
        7      27 d7a5eafb9322 7bded9d9da1f b004912a8510
+       8      28 2ed7a51aed47 c72365ee036f 7bded9d9da1f
 
 (That output if wrong, since no merge actually happened).
 
@@ -814,3 +855,77 @@ 
   |
   o  0 i-0 initial commit: a b]
   
+
+
+Merge:
+- one with change to a file (d)
+- one overwriting that file with a rename (from h to i, to d)
+
+This case is similar to BF/FB, but an actual merge happens, so both side of the
+history are relevant.
+
+Note:
+| In this case, the merge get conflicting information since on one side we have
+| "a -> c -> d". and one the other one we have "h -> i -> d".
+|
+| The current code arbitrarily pick one side
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm-0")'
+  A d
+    a
+  R a
+  R h
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm-0")'
+  A d
+    a
+  R a
+  R h
+  $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFGm-0")'
+  M d
+  $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mGFm-0")'
+  M d
+  $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFGm-0")'
+  M d
+  R i
+  $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mGFm-0")'
+  M d
+  R i
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mFGm-0")'
+  M d
+  R h
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGFm-0")'
+  M d
+  R h
+
+  $ hg log -Gfr 'desc("mFGm-0")' d
+  o    28 mFGm-0 simple merge - one way]
+  |\
+  | o  25 g-1]
+  | |
+  o |  22 f-2: rename i -> d]
+  | |
+  o |  21 f-1: rename h -> i]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b]
+  
+
+
+  $ hg log -Gfr 'desc("mGFm-0")' d
+  o    29 mGFm-0 simple merge - the other way]
+  |\
+  | o  25 g-1]
+  | |
+  o |  22 f-2: rename i -> d]
+  | |
+  o |  21 f-1: rename h -> i]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b]
+