~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge.py

bugfix from Aaron Bentley - bzrlib.graph.max_distance had an off-by-1 error

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import os
2
 
 
3
1
from bzrlib.branch import Branch
4
2
from bzrlib.commit import commit
5
3
from bzrlib.selftest import TestCaseInTempDir
6
4
from bzrlib.merge import merge
7
 
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
 
5
from bzrlib.errors import UnrelatedBranches, NoCommits
8
6
from bzrlib.revision import common_ancestor
9
 
from bzrlib.fetch import fetch
10
 
 
11
 
 
 
7
import os
12
8
class TestMerge(TestCaseInTempDir):
13
9
    """Test appending more than one revision"""
14
10
    def test_pending(self):
37
33
        """When base is forced to revno 0, pending_merges is set"""
38
34
        br2 = self.test_unrelated()
39
35
        br1 = Branch.open('.')
40
 
        fetch(from_branch=br2, to_branch=br1)
41
 
        # merge all of branch 2 into branch 1 even though they 
42
 
        # are not related.
43
 
        self.assertRaises(BzrCommandError, merge, ['branch2', -1], 
44
 
                          ['branch2', 0], reprocess=True, show_base=True)
45
 
        merge(['branch2', -1], ['branch2', 0], reprocess=True)
 
36
        merge(['branch2', -1], ['branch2', 0])
46
37
        self.assertEquals(len(br1.pending_merges()), 1)
47
38
        return (br1, br2)
48
39
 
50
41
        """Merge base is sane when two unrelated branches are merged"""
51
42
        br1, br2 = self.test_pending_with_null()
52
43
        commit(br1, "blah")
53
 
        last = br1.last_revision()
 
44
        last = br1.last_patch()
54
45
        self.assertEquals(common_ancestor(last, last, br1), last)