6
from bzrlib.selftest import InTempDir, TestCase
4
from bzrlib.selftest import TestCaseInTempDir, TestCase
7
5
from bzrlib.branch import ScratchBranch, Branch
8
6
from bzrlib.errors import NotBranchError, NotVersionedError
11
class TestBranch(InTempDir):
9
class TestBranch(TestCaseInTempDir):
13
11
def test_unknowns(self):
14
12
b = Branch('.', init=True)
72
70
'Martin Pool <mbp@sourcefrog.net>-20050311061123-96a255005c7c9dbe')
75
class PendingMerges(InTempDir):
73
class PendingMerges(TestCaseInTempDir):
76
75
def test_pending_merges(self):
77
76
"""Tracking pending-merged revisions."""
78
77
b = Branch('.', init=True)
80
79
self.assertEquals(b.pending_merges(), [])
82
b.add_pending_merge('foo@azkhazan-123123-abcabc')
84
self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
86
b.add_pending_merge('foo@azkhazan-123123-abcabc')
88
self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
80
b.add_pending_merge('foo@azkhazan-123123-abcabc')
81
self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
82
b.add_pending_merge('foo@azkhazan-123123-abcabc')
83
self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
90
84
b.add_pending_merge('wibble@fofof--20050401--1928390812')
91
85
self.assertEquals(b.pending_merges(),
92
86
['foo@azkhazan-123123-abcabc',
93
87
'wibble@fofof--20050401--1928390812'])
95
88
b.commit("commit from base with two merges")
97
89
rev = b.get_revision(b.revision_history()[0])
98
90
self.assertEquals(len(rev.parents), 2)
99
91
self.assertEquals(rev.parents[0].revision_id,
100
92
'foo@azkhazan-123123-abcabc')
101
93
self.assertEquals(rev.parents[1].revision_id,
102
94
'wibble@fofof--20050401--1928390812')
104
95
# list should be cleared when we do a commit
105
96
self.assertEquals(b.pending_merges(), [])