D6252: tests: make merge conflicts explicit in `hg annotate` tests

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Apr 16 13:23:47 EDT 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We were using `true` as merge tool. I think it makes the test easier
  to understand if we make the conflicts explcit. It also papered over a
  conflict that shouldn't have been a conflict (just a bug in copy
  tracing). I've marked that "BROKEN".

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-annotate.t
  tests/test-fastannotate-hg.t
  tests/test-fastannotate-perfhack.t
  tests/test-fastannotate-protocol.t
  tests/test-fastannotate.t

CHANGE DETAILS

diff --git a/tests/test-fastannotate.t b/tests/test-fastannotate.t
--- a/tests/test-fastannotate.t
+++ b/tests/test-fastannotate.t
@@ -3,8 +3,6 @@
   > fastannotate=
   > EOF
 
-  $ HGMERGE=true; export HGMERGE
-
   $ hg init repo
   $ cd repo
 
diff --git a/tests/test-fastannotate-protocol.t b/tests/test-fastannotate-protocol.t
--- a/tests/test-fastannotate-protocol.t
+++ b/tests/test-fastannotate-protocol.t
@@ -7,8 +7,6 @@
   > mainbranch=@
   > EOF
 
-  $ HGMERGE=true; export HGMERGE
-
 setup the server repo
 
   $ hg init repo-server
diff --git a/tests/test-fastannotate-perfhack.t b/tests/test-fastannotate-perfhack.t
--- a/tests/test-fastannotate-perfhack.t
+++ b/tests/test-fastannotate-perfhack.t
@@ -5,8 +5,6 @@
   > perfhack=1
   > EOF
 
-  $ HGMERGE=true; export HGMERGE
-
   $ hg init repo
   $ cd repo
 
diff --git a/tests/test-fastannotate-hg.t b/tests/test-fastannotate-hg.t
--- a/tests/test-fastannotate-hg.t
+++ b/tests/test-fastannotate-hg.t
@@ -1,6 +1,8 @@
 (this file is backported from core hg tests/test-annotate.t)
 
   $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > merge = :merge3
   > [diff]
   > git=1
   > [extensions]
@@ -11,8 +13,6 @@
   > mainbranch=.
   > EOF
 
-  $ HGMERGE=true; export HGMERGE
-
 init
 
   $ hg init repo
@@ -157,8 +157,34 @@
   created new head
   $ hg merge
   merging b
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat b
+  a
+  a
+  a
+  <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
+  b4
+  c
+  b5
+  ||||||| base
+  =======
+  b4
+  b5
+  b6
+  >>>>>>> merge rev:    37ec9f5c3d1f - test: b2
+  $ cat <<EOF > b
+  > a
+  > a
+  > a
+  > b4
+  > c
+  > b5
+  > EOF
+  $ hg resolve --mark -q
+  $ rm b.orig
   $ hg ci -mmergeb -d '3 0'
 
 annotate after merge
@@ -247,15 +273,37 @@
   > EOF
   $ hg ci -mc -d '3 0'
   created new head
+BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
   $ hg merge
   merging b
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
-  $ cat <<EOF >> b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat b
+  <<<<<<< working copy: b80e3e32f75a - test: c
+  a
+  z
+  a
+  ||||||| base
+  =======
+  a
+  a
+  a
+  b4
+  c
+  b5
+  >>>>>>> merge rev:    64afcdf8e29e - test: mergeb
+  $ cat <<EOF > b
+  > a
+  > z
+  > a
   > b4
   > c
   > b5
   > EOF
+  $ hg resolve --mark -q
+  $ rm b.orig
   $ echo d >> b
   $ hg ci -mmerge2 -d '4 0'
 
@@ -745,14 +793,28 @@
   $ echo 3 >> a
   $ hg commit -m 3 -q
   $ hg merge 2 -q
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  [1]
+  $ cat a
+  <<<<<<< working copy: 0a068f0261cf - test: 3
+  1
+  2
+  3
+  ||||||| base
+  1
+  2
+  =======
+  a
+  >>>>>>> merge rev:    9409851bc20a - test: a
   $ cat > a << EOF
   > b
   > 1
   > 2
   > 3
   > a
   > EOF
   $ hg resolve --mark -q
+  $ rm a.orig
   $ hg commit -m m
   $ hg annotate a
   4: b
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -1,4 +1,7 @@
-  $ HGMERGE=true; export HGMERGE
+  $ cat >> "$HGRCPATH" << EOF
+  > [ui]
+  > merge = :merge3
+  > EOF
 
 init
 
@@ -210,8 +213,34 @@
   created new head
   $ hg merge
   merging b
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat b
+  a
+  a
+  a
+  <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
+  b4
+  c
+  b5
+  ||||||| base
+  =======
+  b4
+  b5
+  b6
+  >>>>>>> merge rev:    37ec9f5c3d1f - test: b2
+  $ cat <<EOF > b
+  > a
+  > a
+  > a
+  > b4
+  > c
+  > b5
+  > EOF
+  $ hg resolve --mark -q
+  $ rm b.orig
   $ hg ci -mmergeb -d '3 0'
 
 annotate after merge
@@ -244,15 +273,37 @@
   > EOF
   $ hg ci -mc -d '3 0'
   created new head
+BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
   $ hg merge
   merging b
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
-  $ cat <<EOF >> b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat b
+  <<<<<<< working copy: b80e3e32f75a - test: c
+  a
+  z
+  a
+  ||||||| base
+  =======
+  a
+  a
+  a
+  b4
+  c
+  b5
+  >>>>>>> merge rev:    64afcdf8e29e - test: mergeb
+  $ cat <<EOF > b
+  > a
+  > z
+  > a
   > b4
   > c
   > b5
   > EOF
+  $ hg resolve --mark -q
+  $ rm b.orig
   $ echo d >> b
   $ hg ci -mmerge2 -d '4 0'
 
@@ -695,8 +746,41 @@
   27: baz:3+->3-
   $ hg merge 25
   merging baz and qux to qux
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
+  warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat qux
+  0
+  0
+  1 baz:1
+  2 baz:2
+  <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
+  3- baz:3
+  4 baz:4
+  ||||||| base
+  3+ baz:3
+  4 baz:4
+  =======
+  3+ baz:3
+  4+ baz:4
+  >>>>>>> merge rev:    cb8df70ae185 - test: qux:4->4+
+  5
+  6
+  7
+  $ cat > qux <<EOF
+  > 0
+  > 0
+  > 1 baz:1
+  > 2 baz:2
+  > 3- baz:3
+  > 4 baz:4
+  > 5
+  > 6
+  > 7
+  > EOF
+  $ hg resolve --mark -q
+  $ rm qux.orig
   $ hg ci -m merge
   $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
   16: baz:0
@@ -709,8 +793,40 @@
   $ hg up 25 --quiet
   $ hg merge 27
   merging qux and baz to qux
-  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  (branch merge, don't forget to commit)
+  warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]
+  $ cat qux
+  0
+  0
+  1 baz:1
+  2 baz:2
+  <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
+  3+ baz:3
+  4+ baz:4
+  ||||||| base
+  3+ baz:3
+  4 baz:4
+  =======
+  3- baz:3
+  4 baz:4
+  >>>>>>> merge rev:    863de62655ef - test: baz:3+->3-
+  5
+  6
+  7
+  $ cat > qux <<EOF
+  > 0
+  > 0
+  > 1 baz:1
+  > 2 baz:2
+  > 3+ baz:3
+  > 4+ baz:4
+  > 5
+  > 6
+  > EOF
+  $ hg resolve --mark -q
+  $ rm qux.orig
   $ hg ci -m 'merge from other side'
   created new head
   $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
@@ -1061,14 +1177,28 @@
   $ echo 3 >> a
   $ hg commit -m 3 -q
   $ hg merge 2 -q
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  [1]
+  $ cat a
+  <<<<<<< working copy: 0a068f0261cf - test: 3
+  1
+  2
+  3
+  ||||||| base
+  1
+  2
+  =======
+  a
+  >>>>>>> merge rev:    9409851bc20a - test: a
   $ cat > a << EOF
   > b
   > 1
   > 2
   > 3
   > a
   > EOF
   $ hg resolve --mark -q
+  $ rm a.orig
   $ hg commit -m m
   $ hg annotate a
   4: b



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list