Patchwork D8939: tests: add more criss-cross merging tests where behavior needs to be fixed

login
register
mail settings
Submitter phabricator
Date Aug. 24, 2020, 2:14 p.m.
Message ID <differential-rev-PHID-DREV-twjdnmc43ehjq5okqzj7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47039/
State Superseded
Headers show

Comments

phabricator - Aug. 24, 2020, 2:14 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-merge-criss-cross.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -444,3 +444,106 @@ 
   getting d2/b
   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
+
+Testing that whether a new filenode is created or not
+-----------------------------------------------------
+
+  $ cd ../
+  $ hg init criss-cross-delete-revert
+  $ cd criss-cross-delete-revert
+  $ echo foo > foo
+  $ hg ci -Aqm 'added foo'
+  $ hg debugrevlogindex foo
+     rev linkrev nodeid       p1           p2
+       0       0 2ed2a3912a0b 000000000000 000000000000
+  $ hg rm foo
+  $ hg ci -m 'removed foo'
+  $ hg up '.^'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar > bar
+  $ hg ci -Aqm 'added bar'
+
+  $ hg log -G -T '{node|short} {desc}\n'
+  @  f63db81e6dde added bar
+  |
+  | o  1a0ab2bd5b5a removed foo
+  |/
+  o  f3ba8b99bb6f added foo
+  
+
+  $ hg merge
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg st
+  R foo
+  $ hg ci -m 'merged without foo'
+  $ hg log -G -T '{node|short} {desc}\n'
+  @    411bc7ca43bc merged without foo
+  |\
+  | o  f63db81e6dde added bar
+  | |
+  o |  1a0ab2bd5b5a removed foo
+  |/
+  o  f3ba8b99bb6f added foo
+  
+  $ test -f foo
+  [1]
+
+  $ hg co 1a0ab2bd5b5a
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge f63db81e6dde
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg revert foo --rev 'p2()'
+  $ hg st
+  M bar
+  M foo
+  $ hg ci -m 'merged with foo'
+  created new head
+  $ hg log -G -T '{node|short} {desc}\n'
+  @    9c9dbcbc1e03 merged with foo
+  |\
+  +---o  411bc7ca43bc merged without foo
+  | |/
+  | o  f63db81e6dde added bar
+  | |
+  o |  1a0ab2bd5b5a removed foo
+  |/
+  o  f3ba8b99bb6f added foo
+  
+  $ hg debugrevlogindex foo
+     rev linkrev nodeid       p1           p2
+       0       0 2ed2a3912a0b 000000000000 000000000000
+
+  $ cat foo
+  foo
+
+Criss crossing merges now
+
+  $ hg log -G -T '{node|short} {desc}\n'
+  @    9c9dbcbc1e03 merged with foo
+  |\
+  +---o  411bc7ca43bc merged without foo
+  | |/
+  | o  f63db81e6dde added bar
+  | |
+  o |  1a0ab2bd5b5a removed foo
+  |/
+  o  f3ba8b99bb6f added foo
+  
+We should prompt instead of silently choosing a side here
+  $ hg merge 411bc7ca43bc
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ ls
+  bar
+
+We should prompt instead of silently choosing a side here
+  $ hg co 411bc7ca43bc -C
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 9c9dbcbc1e03
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ ls
+  bar
+  foo