~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: John Arbash Meinel
  • Date: 2006-03-08 14:31:23 UTC
  • mfrom: (1598 +trunk)
  • mto: (1685.1.1 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060308143123-448308b0db4de410
[merge] bzr.dev 1573, lots of updates

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.fetch import fetch
8
 
from bzrlib.merge import transform_tree
 
8
from bzrlib.merge import transform_tree, merge_inner
9
9
from bzrlib.osutils import pathjoin
10
10
from bzrlib.revision import common_ancestor
11
11
from bzrlib.tests import TestCaseWithTransport
 
12
from bzrlib.trace import (enable_test_log, disable_test_log)
12
13
from bzrlib.workingtree import WorkingTree
13
14
 
14
15
 
39
40
    def test_pending_with_null(self):
40
41
        """When base is forced to revno 0, pending_merges is set"""
41
42
        wt2 = self.test_unrelated()
42
 
        wt1 = WorkingTree('.')
 
43
        wt1 = WorkingTree.open('.')
43
44
        br1 = wt1.branch
44
 
        fetch(from_branch=wt2.branch, to_branch=br1)
 
45
        br1.fetch(wt2.branch)
45
46
        # merge all of branch 2 into branch 1 even though they 
46
47
        # are not related.
47
48
        self.assertRaises(BzrCommandError, merge, ['branch2', -1], 
80
81
        tree.rename_one(filename, filename2)
81
82
        tree.rename_one('dirname1', 'dirname2')
82
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)