~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge.py

merge merge tweaks from aaron, which includes latest .dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from bzrlib.selftest import TestCaseInTempDir
4
4
from bzrlib.merge import merge
5
5
from bzrlib.errors import UnrelatedBranches, NoCommits
 
6
from bzrlib.revision import common_ancestor
6
7
import os
7
8
class TestMerge(TestCaseInTempDir):
8
9
    """Test appending more than one revision"""
24
25
    def test_unrelated(self):
25
26
        br2 = self.test_nocommits()
26
27
        commit(br2, "blah")
27
 
        merge, ['branch2', -1], [None, None]
28
28
        self.assertRaises(UnrelatedBranches, merge, ['branch2', -1], 
29
29
                          [None, None])
30
 
 
 
30
        return br2
 
31
 
 
32
    def test_pending_with_null(self):
 
33
        """When base is forced to revno 0, pending_merges is set"""
 
34
        br2 = self.test_unrelated()
 
35
        br1 = Branch.open('.')
 
36
        merge(['branch2', -1], ['branch2', 0])
 
37
        self.assertEquals(len(br1.pending_merges()), 1)
 
38
        return (br1, br2)
 
39
 
 
40
    def test_two_roots(self):
 
41
        """Merge base is sane when two unrelated branches are merged"""
 
42
        br1, br2 = self.test_pending_with_null()
 
43
        commit(br1, "blah")
 
44
        last = br1.last_patch()
 
45
        self.assertEquals(common_ancestor(last, last, br1), last)