Patchwork D8241: copies-tests: add a case where a file is deleted/added but with a merge

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

Comments

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8241?vs=20531&id=20548

BRANCH
  default

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

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

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
@@ -346,49 +346,98 @@ 
   o  0 i-0 initial commit: a b]
   
 
+Merge:
+- one with change to a file
+- one deleting and recreating the file
+
+  $ hg up 'desc("i-2")'
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "some update" >> d
+  $ hg commit -m "g-1"
+  created new head
+  $ hg up 'desc("d-2")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("g-1")' --tool :union
+  merging d
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mDGm-0 simple merge - one way'
+  $ hg up 'desc("g-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("d-2")' --tool :union
+  merging d
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mGDm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
+  @    27 mGDm-0 simple merge - the other way]
+  |\
+  +---o  26 mDGm-0 simple merge - one way]
+  | |/
+  | o  25 g-1]
+  | |
+  o |  14 d-2 re-add d]
+  | |
+  o |  13 d-1 delete d]
+  |/
+  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    24 mFBm-0 simple merge - the other way]
+  o    27 mGDm-0 simple merge - the other way]
   |\
-  +---o  23 mBFm-0 simple merge - one way]
+  +---o  26 mDGm-0 simple merge - one way]
   | |/
-  | o  22 f-2: rename i -> d]
+  | o  25 g-1]
   | |
-  | o  21 f-1: rename h -> i]
-  | |
-  | | o    20 mEAm-0 simple merge - the other way]
+  | | o    24 mFBm-0 simple merge - the other way]
   | | |\
-  | | +---o  19 mAEm-0 simple merge - one way]
+  | | +---o  23 mBFm-0 simple merge - one way]
   | | | |/
-  | | | o  18 e-2 g -move-> f]
-  | | | |
-  | +---o  17 e-1 b -move-> g]
-  | | |
-  +-----o  16 mDBm-0 simple merge - the other way]
+  | | | o  22 f-2: rename i -> d]
   | | | |
-  +-------o  15 mBDm-0 simple merge - one way]
-  | | | |/
-  | | | o  14 d-2 re-add d]
+  | +---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  13 d-1 delete d]
-  | | |
+  +---+---o  16 mDBm-0 simple merge - the other way]
+  | | | |
+  +---+---o  15 mBDm-0 simple merge - one way]
+  | | | |
+  o | | |  14 d-2 re-add d]
+  | | | |
+  o | | |  13 d-1 delete d]
+  |/ / /
   | | | o  12 mCBm-1 re-add d]
   | | | |
-  +-----o  11 mCBm-0 simple merge - the other way]
+  | +---o  11 mCBm-0 simple merge - the other way]
   | | | |
   | | | | o  10 mBCm-1 re-add d]
   | | | | |
-  +-------o  9 mBCm-0 simple merge - one way]
+  | +-----o  9 mBCm-0 simple merge - one way]
   | | | |/
-  | +---o  8 c-1 delete d]
+  +-----o  8 c-1 delete d]
   | | |
-  +-----o  7 mABm-0 simple merge - the other way]
+  | +---o  7 mABm-0 simple merge - the other way]
   | | |/
-  +-----o  6 mBAm-0 simple merge - one way]
+  | +---o  6 mBAm-0 simple merge - one way]
   | | |/
-  o | |  5 b-1: b update]
+  | o |  5 b-1: b update]
   |/ /
   | o  4 a-2: e -move-> f]
   | |
@@ -552,6 +601,9 @@ 
        2      15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
        3      22 c72365ee036f 000000000000 000000000000
        4      23 863d9bc49190 01c2f5eabdc4 c72365ee036f
+       5      25 7bded9d9da1f 01c2f5eabdc4 000000000000
+       6      26 f04cac32d703 b004912a8510 7bded9d9da1f
+       7      27 d7a5eafb9322 7bded9d9da1f b004912a8510
 
 (That output if wrong, since no merge actually happened).
 
@@ -708,3 +760,57 @@ 
   :
   o  0 i-0 initial commit: a b]
   
+
+Merge:
+- one with change to a file
+- one deleting and recreating the file
+
+Unlike in the 'BD/DB' cases, an actuall merge happened here. So we should
+consider history and rename on both branch of the merge.
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
+  A d
+    a
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
+  A d
+    a
+  R a
+  $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDGm-0")'
+  M d
+  $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mGDm-0")'
+  M d
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mDGm-0")'
+  M d
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGDm-0")'
+  M d
+
+  $ hg log -Gfr 'desc("mDGm-0")' d
+  o    26 mDGm-0 simple merge - one way]
+  |\
+  | o  25 g-1]
+  | |
+  o |  14 d-2 re-add d]
+  |/
+  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("mDGm-0")' d
+  o    26 mDGm-0 simple merge - one way]
+  |\
+  | o  25 g-1]
+  | |
+  o |  14 d-2 re-add d]
+  |/
+    k (false !)
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b]
+