~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge.py

Merge in format-5 work - release bzr 0.1rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
 
1
3
from bzrlib.branch import Branch
2
4
from bzrlib.commit import commit
3
5
from bzrlib.selftest import TestCaseInTempDir
4
6
from bzrlib.merge import merge
5
7
from bzrlib.errors import UnrelatedBranches, NoCommits
6
8
from bzrlib.revision import common_ancestor
7
 
import os
 
9
from bzrlib.fetch import fetch
 
10
 
 
11
 
8
12
class TestMerge(TestCaseInTempDir):
9
13
    """Test appending more than one revision"""
10
14
    def test_pending(self):
33
37
        """When base is forced to revno 0, pending_merges is set"""
34
38
        br2 = self.test_unrelated()
35
39
        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.
36
43
        merge(['branch2', -1], ['branch2', 0])
37
44
        self.assertEquals(len(br1.pending_merges()), 1)
38
45
        return (br1, br2)
41
48
        """Merge base is sane when two unrelated branches are merged"""
42
49
        br1, br2 = self.test_pending_with_null()
43
50
        commit(br1, "blah")
44
 
        last = br1.last_patch()
 
51
        last = br1.last_revision()
45
52
        self.assertEquals(common_ancestor(last, last, br1), last)