Patchwork D8240: copies-tests: add a test with a rename overwriting another file

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

Comments

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8240?vs=20530&id=20547

BRANCH
  default

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

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

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
@@ -298,21 +298,77 @@ 
 | In this case, on of the merge record bad information and fails to see that
 | there is no merge going on.
 
+Merge:
+- one with change to an unrelated file (b)
+- one overwriting a file (d) with a rename (from h to i to d)
+
+  $ hg up 'desc("i-2")'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg mv h i
+  $ hg commit -m "f-1: rename h -> i"
+  created new head
+  $ hg mv --force i d
+  $ hg commit -m "f-2: rename i -> d"
+  $ hg debugindex d
+     rev linkrev nodeid       p1           p2
+       0       2 01c2f5eabdc4 000000000000 000000000000
+       1      10 b004912a8510 000000000000 000000000000
+       2      15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
+       3      22 c72365ee036f 000000000000 000000000000
+  $ hg up 'desc("b-1")'
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("f-2")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mBFm-0 simple merge - one way'
+  $ hg up 'desc("f-2")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("b-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mFBm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
+  @    24 mFBm-0 simple merge - the other way]
+  |\
+  +---o  23 mBFm-0 simple merge - one way]
+  | |/
+  | o  22 f-2: rename i -> d]
+  | |
+  | o  21 f-1: rename h -> i]
+  | |
+  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]
+  
+
 final summary
 
   $ hg update null --quiet
   $ hg log -G
-  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  22 f-2: rename i -> d]
+  | |
+  | o  21 f-1: rename h -> i]
   | |
-  | o  17 e-1 b -move-> g]
-  | |
-  | | o    16 mDBm-0 simple merge - the other way]
+  | | o    20 mEAm-0 simple merge - the other way]
   | | |\
-  | | +---o  15 mBDm-0 simple merge - one way]
+  | | +---o  19 mAEm-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  15 mBDm-0 simple merge - one way]
   | | | |/
   | | | o  14 d-2 re-add d]
   | | | |
@@ -320,11 +376,11 @@ 
   | | |
   | | | 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]
   | | |
@@ -332,11 +388,11 @@ 
   | | |/
   +-----o  6 mBAm-0 simple merge - one way]
   | | |/
-  | | o  5 b-1: b update]
-  | |/
-  o |  4 a-2: e -move-> f]
+  o | |  5 b-1: b update]
+  |/ /
+  | o  4 a-2: e -move-> f]
   | |
-  o |  3 a-1: d -move-> e]
+  | o  3 a-1: d -move-> e]
   |/
   o  2 i-2: c -move-> d]
   |
@@ -494,6 +550,8 @@ 
        0       2 01c2f5eabdc4 000000000000 000000000000
        1      10 b004912a8510 000000000000 000000000000
        2      15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
+       3      22 c72365ee036f 000000000000 000000000000
+       4      23 863d9bc49190 01c2f5eabdc4 c72365ee036f
 
 (That output if wrong, since no merge actually happened).
 
@@ -585,3 +643,68 @@ 
     a
   R a
   R b
+
+Merge:
+- one with change to an unrelated file (b)
+- one overwriting a file (d) with a rename (from h to i to d)
+
+The overwriting should take over. However, the behavior is currently buggy
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBFm-0")'
+  M b
+  A d
+    a (true !)
+    h (false !)
+  R a
+  R h
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFBm-0")'
+  M b
+  A d
+    h
+  R a
+  R h
+  $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBFm-0")'
+  M d
+  R h
+  $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mBFm-0")'
+  M b
+  M d
+  $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mBFm-0")'
+  M b
+  M d
+  R i
+  $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mFBm-0")'
+  M d
+  R h
+  $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFBm-0")'
+  M b
+  $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFBm-0")'
+  M b
+  M d
+  R i
+
+The following graphlog is wrong, the "a -> c -> d" chain was overwritten and should not appear.
+
+  $ hg log -Gfr 'desc("mBFm-0")' d
+  o    23 mBFm-0 simple merge - one way]
+  |\
+  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]
+  
+
+The following output is correct.
+
+  $ hg log -Gfr 'desc("mFBm-0")' d
+  o  22 f-2: rename i -> d]
+  |
+  o  21 f-1: rename h -> i]
+  :
+  o  0 i-0 initial commit: a b]
+