Patchwork [3,of,5] test-resolve: add more tests for in conflict-free states

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 10, 2014, 4:14 p.m.
Message ID <0210cb7c64ddcdfef4eb.1412957663@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6185/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Oct. 10, 2014, 4:14 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412831948 25200
#      Wed Oct 08 22:19:08 2014 -0700
# Node ID 0210cb7c64ddcdfef4ebadb95a643e23e3a2d28b
# Parent  92cd0aa103261ca361ea99e118e1456d8d6052f9
test-resolve: add more tests for in conflict-free states

We already have a test for 'hg resolve -m' when there is no merge in
progress. Add one for 'hg resolve --all' as well.

Also add tests for both --all and -m when there is a merge without
conflicts in progress. They should both be successful, just as if
there had been conflicts that had been marked resolved. However, that
is currently broken, so mark the tests broken for now. The behavior
will be fixed in a later patch.

Patch

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -13,7 +13,7 @@ 
   $ echo bar >> file2
   $ hg commit -Am 'append bar to files'
 
-create a second head
+create a second head with conflicting edits
 
   $ hg up -C 0
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -22,9 +22,17 @@ 
   $ hg commit -Am 'append baz to files'
   created new head
 
+create a third head with no conflicting edits
+  $ hg up -qC 0
+  $ echo foo > file3
+  $ hg commit -Am 'add non-conflicting file'
+  adding file3
+  created new head
+
 failing merge
 
-  $ hg merge --tool=internal:fail
+  $ hg up -qC 2
+  $ hg merge --tool=internal:fail 1
   0 files updated, 0 files merged, 0 files removed, 2 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -61,14 +69,39 @@ 
 
   $ hg resolve -l
 
+resolve --all should abort when no merge in progress
+
+  $ hg resolve --all
+  abort: resolve command not applicable when not merging
+  [255]
+
 resolve -m should abort when no merge in progress
 
   $ hg resolve -m
   abort: resolve command not applicable when not merging
   [255]
 
+set up conflict-free merge
+
+  $ hg up -qC 3
+  $ hg merge 1
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+BROKEN: resolve --all should do nothing in merge without conflicts
+  $ hg resolve --all
+  abort: resolve command not applicable when not merging
+  [255]
+
+BROKEN: resolve -m should do nothing in merge without conflicts
+
+  $ hg resolve -m
+  abort: resolve command not applicable when not merging
+  [255]
+
 test crashed merge with empty mergestate
 
+  $ hg up -qC 1
   $ mkdir .hg/merge
   $ touch .hg/merge/state