~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
 
2
from StringIO import StringIO
2
3
 
3
4
from bzrlib.branch import Branch
4
5
from bzrlib.builtins import merge
5
6
from bzrlib.commit import commit
6
7
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
7
 
from bzrlib.merge import transform_tree
 
8
from bzrlib.merge import transform_tree, merge_inner
8
9
from bzrlib.osutils import pathjoin
9
10
from bzrlib.revision import common_ancestor
10
11
from bzrlib.tests import TestCaseWithTransport
 
12
from bzrlib.trace import (enable_test_log, disable_test_log)
11
13
from bzrlib.workingtree import WorkingTree
12
14
 
13
15
 
79
81
        tree.rename_one(filename, filename2)
80
82
        tree.rename_one('dirname1', 'dirname2')
81
83
        transform_tree(tree, tree.branch.basis_tree())
 
84
 
 
85
    def test_ignore_zero_merge_inner(self):
 
86
        # Test that merge_inner's ignore zero paramter is effective
 
87
        tree_a =self.make_branch_and_tree('a')
 
88
        tree_a.commit(message="hello")
 
89
        dir_b = tree_a.bzrdir.sprout('b')
 
90
        tree_b = dir_b.open_workingtree()
 
91
        tree_a.commit(message="hello again")
 
92
        log = StringIO()
 
93
        merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(), 
 
94
                    this_tree=tree_b, ignore_zero=True)
 
95
        lines = self._get_log().splitlines(True)[-1]
 
96
        self.failUnless('All changes applied successfully.\n' not in lines)
 
97
        tree_b.revert([])
 
98
        merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(), 
 
99
                    this_tree=tree_b, ignore_zero=False)
 
100
        lines = self._get_log().splitlines(True)[-1]
 
101
        self.failUnless('All changes applied successfully.\n' in lines)