tests: unify test-merge-default
authorAdrian Buehlmann <adrian@cadifra.com>
Sat, 11 Sep 2010 11:44:53 +0200
changeset 12255 9b3c02c36d92
parent 12254 852f10a15a6d
child 12256 2a06cb547be8
tests: unify test-merge-default
tests/test-merge-default
tests/test-merge-default.out
tests/test-merge-default.t
--- a/tests/test-merge-default	Sat Sep 11 11:18:47 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-hg init
-echo a > a
-hg commit -A -ma
-
-echo b >> a
-hg commit -mb
-
-echo c >> a
-hg commit -mc
-
-hg up 1
-echo d >> a
-hg commit -md
-
-hg up 1
-echo e >> a
-hg commit -me
-
-hg up 1
-echo % should fail because not at a head
-hg merge
-
-hg up
-echo % should fail because \> 2 heads
-HGMERGE=internal:other; export HGMERGE
-hg merge
-
-echo % should succeed
-hg merge 2
-hg commit -mm1
-
-echo % should succeed - 2 heads
-hg merge -P
-hg merge
-hg commit -mm2
-
-echo % should fail because at tip
-hg merge
-
-hg up 0
-echo % should fail because 1 head
-hg merge
-
-hg up 3
-echo f >> a
-hg branch foobranch
-hg commit -mf
-echo % should fail because merge with other branch
-hg merge
-
-# Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
-# are not ancestors of 7, regardless of where their least common
-# ancestor is.
-echo % merge preview not affected by common ancestor
-hg up -q 7
-hg merge -q -P 6         # expect: 2, 4, 5, 6
-
-true
--- a/tests/test-merge-default.out	Sat Sep 11 11:18:47 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-adding a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because not at a head
-abort: branch 'default' has 3 heads - please merge with an explicit rev
-(run 'hg heads .' to see heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because > 2 heads
-abort: branch 'default' has 3 heads - please merge with an explicit rev
-(run 'hg heads .' to see heads)
-% should succeed
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should succeed - 2 heads
-changeset:   3:ea9ff125ff88
-parent:      1:1846eede8b68
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     d
-
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should fail because at tip
-abort: there is nothing to merge
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because 1 head
-abort: there is nothing to merge - use "hg update" instead
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch foobranch
-% should fail because merge with other branch
-abort: branch 'foobranch' has one head - please merge with an explicit rev
-(run 'hg heads' to see all heads)
-% merge preview not affected by common ancestor
-2:2d95304fed5d
-4:f25cbe84d8b3
-5:a431fabd6039
-6:e88e33f3bf62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-default.t	Sat Sep 11 11:44:53 2010 +0200
@@ -0,0 +1,104 @@
+  $ hg init
+  $ echo a > a
+  $ hg commit -A -ma
+  adding a
+
+  $ echo b >> a
+  $ hg commit -mb
+
+  $ echo c >> a
+  $ hg commit -mc
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo d >> a
+  $ hg commit -md
+  created new head
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo e >> a
+  $ hg commit -me
+  created new head
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because not at a head:
+
+  $ hg merge
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because > 2 heads:
+
+  $ HGMERGE=internal:other; export HGMERGE
+  $ hg merge
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+
+Should succeed:
+
+  $ hg merge 2
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -mm1
+
+Should succeed - 2 heads:
+
+  $ hg merge -P
+  changeset:   3:ea9ff125ff88
+  parent:      1:1846eede8b68
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     d
+  
+  $ hg merge
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -mm2
+
+Should fail because at tip:
+
+  $ hg merge
+  abort: there is nothing to merge
+
+  $ hg up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because there is only one head:
+
+  $ hg merge
+  abort: there is nothing to merge - use "hg update" instead
+
+  $ hg up 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo f >> a
+  $ hg branch foobranch
+  marked working directory as branch foobranch
+  $ hg commit -mf
+
+Should fail because merge with other branch:
+
+  $ hg merge
+  abort: branch 'foobranch' has one head - please merge with an explicit rev
+  (run 'hg heads' to see all heads)
+
+
+Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
+are not ancestors of 7, regardless of where their least common
+ancestor is.
+
+Merge preview not affected by common ancestor:
+
+  $ hg up -q 7
+  $ hg merge -q -P 6
+  2:2d95304fed5d
+  4:f25cbe84d8b3
+  5:a431fabd6039
+  6:e88e33f3bf62
+