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

login
register
mail settings
Submitter phabricator
Date March 5, 2020, 6:14 p.m.
Message ID <differential-rev-PHID-DREV-y2shm3iyfjpvu2ei4h27-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45525/
State Superseded
Headers show

Comments

phabricator - March 5, 2020, 6:14 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is similar to the BF/FB case, but in this case, the other branch updated
  the file. So an actual merge happens and the two "independant" file history has
  to be merged.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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
phabricator - March 6, 2020, 6:26 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> test-copies-chain-merge.t:411
> +  created new head
> +  $ hg log -G --rev '::(desc("mGFm")+desc("mGFm"))'
> +  @    29 mGFm-0 simple merge - the other way]

one of them should be "mFGm"

> test-copies-chain-merge.t:412
> +  $ hg log -G --rev '::(desc("mGFm")+desc("mGFm"))'
> +  @    29 mGFm-0 simple merge - the other way]
> +  |\

just out of curiosity, what does the trailing "]" you put in the template indicate?

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - March 6, 2020, 9:50 p.m.
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-copies-chain-merge.t:411
> one of them should be "mFGm"

right, good spot. Thanks

> martinvonz wrote in test-copies-chain-merge.t:412
> just out of curiosity, what does the trailing "]" you put in the template indicate?

This is probably a typo. We can clean it up afterward.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - March 6, 2020, 9:51 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in test-copies-chain-merge.t:412
> This is probably a typo. We can clean it up afterward.

Sure. Could you include that fix in the series? I've seen too many "we can clean it up afterward" be forgotten.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: martinvonz, 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]
+