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

login
register
mail settings
Submitter phabricator
Date March 5, 2020, 6:14 p.m.
Message ID <differential-rev-PHID-DREV-37dparillqpjv7v3ila3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45523/
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 a variation of the "BD" case, but this time, the file is not "new", it
  is overwritten by another file being renamed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

INLINE COMMENTS

> test-copies-chain-merge.t:349
> +
>  final summary
>  

unrelated to this patch, but maybe we can also remove this final summary? i've never looked at it while reviewing theses patches and i don't feel like i've missed anything as a result.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - March 6, 2020, 4:35 p.m.
marmoute added a comment.


  Yes, it

INLINE COMMENTS

> martinvonz wrote in test-copies-chain-merge.t:349
> unrelated to this patch, but maybe we can also remove this final summary? i've never looked at it while reviewing theses patches and i don't feel like i've missed anything as a result.

Yes, it was more useful at the begining, when less branch were involved?

REPOSITORY
  rHG Mercurial

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

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

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

INLINE COMMENTS

> marmoute wrote in test-copies-chain-merge.t:349
> Yes, it was more useful at the begining, when less branch were involved?

Okay, want to send a patch removing it then? Ideally that patch would come early in the series so the other patches (like this one) would get simpler.

REPOSITORY
  rHG Mercurial

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

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

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

INLINE COMMENTS

> martinvonz wrote in test-copies-chain-merge.t:349
> Okay, want to send a patch removing it then? Ideally that patch would come early in the series so the other patches (like this one) would get simpler.

Yes, my previous message implied I would do so in the next iteration.

[grmlm, comment not sent]

REPOSITORY
  rHG Mercurial

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

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

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
@@ -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]
+