27
27
from bzrlib import (
28
28
branch as _mod_branch,
31
33
import bzrlib.branch
32
34
from bzrlib.branch import (BzrBranch5,
34
import bzrlib.bzrdir as bzrdir
35
36
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1,
36
37
BzrDir, BzrDirFormat)
37
38
from bzrlib.errors import (NotBranchError,
207
208
self.failIfExists('a/.bzr/branch/bound')
208
209
self.assertEqual('ftp://bazaar-vcs.org', branch.get_bound_location())
211
def test_set_revision_history(self):
212
tree = self.make_branch_and_memory_tree('.',
213
format='experimental-branch6')
217
tree.commit('foo', rev_id='foo')
218
tree.commit('bar', rev_id='bar')
219
tree.branch.set_revision_history(['foo', 'bar'])
220
tree.branch.set_revision_history(['foo'])
221
self.assertRaises(errors.NotLefthandHistory,
222
tree.branch.set_revision_history, ['bar'])
227
def test_append_revision(self):
228
tree = self.make_branch_and_tree('branch1',
229
format='experimental-branch6')
233
tree.commit('foo', rev_id='foo')
234
tree.commit('bar', rev_id='bar')
235
tree.commit('baz', rev_id='baz')
236
tree.set_last_revision('bar')
237
tree.branch.set_last_revision('bar')
238
tree.commit('qux', rev_id='qux')
239
tree.add_parent_tree_id('baz')
240
tree.commit('qux', rev_id='quxx')
241
tree.branch.set_last_revision('null:')
242
self.assertRaises(errors.NotLeftParentDescendant,
243
tree.branch.append_revision, 'bar')
244
tree.branch.append_revision('foo')
245
self.assertRaises(errors.NotLeftParentDescendant,
246
tree.branch.append_revision, 'baz')
247
tree.branch.append_revision('bar')
248
tree.branch.append_revision('baz')
249
self.assertRaises(errors.NotLeftParentDescendant,
250
tree.branch.append_revision, 'quxx')
211
253
class TestBranchReference(TestCaseWithTransport):
212
254
"""Tests for the branch reference facility."""