~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-19 03:26:14 UTC
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050919032614-79751b0510f24929
Major refactoring of testtransport.
Rewrote test_transport() as a class which can be subclassed which provides
many test_* functions, rather than one large function.
Much easier to debug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib.branch import Branch
 
2
from bzrlib.commit import commit
 
3
from bzrlib.selftest import TestCaseInTempDir
 
4
from bzrlib.merge import merge
 
5
from bzrlib.errors import UnrelatedBranches, NoCommits
 
6
import os
 
7
class TestMerge(TestCaseInTempDir):
 
8
    """Test appending more than one revision"""
 
9
    def test_pending(self):
 
10
        br = Branch.initialize(".")
 
11
        commit(br, "lala!")
 
12
        self.assertEquals(len(br.pending_merges()), 0)
 
13
        merge(['.', -1], [None, None])
 
14
        self.assertEquals(len(br.pending_merges()), 0)
 
15
 
 
16
    def test_nocommits(self):
 
17
        self.test_pending()
 
18
        os.mkdir('branch2')
 
19
        br2 = Branch.initialize('branch2')
 
20
        self.assertRaises(NoCommits, merge, ['branch2', -1], 
 
21
                          [None, None])
 
22
        return br2
 
23
 
 
24
    def test_unrelated(self):
 
25
        br2 = self.test_nocommits()
 
26
        commit(br2, "blah")
 
27
        merge, ['branch2', -1], [None, None]
 
28
        self.assertRaises(UnrelatedBranches, merge, ['branch2', -1], 
 
29
                          [None, None])
 
30