43
43
from bzrlib.branch import Branch
44
import bzrlib.bzrdir as bzrdir
44
45
from bzrlib.errors import BzrCommandError
45
46
from bzrlib.osutils import has_symlinks, pathjoin
46
47
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
358
359
self.runbzr('commit -m foo --unchanged')
360
# naughty - abstraction violations RBC 20050928
361
print "test_branch used to delete the stores, how is this meant to work ?"
362
#shutil.rmtree('a/.bzr/revision-store')
363
#shutil.rmtree('a/.bzr/inventory-store', ignore_errors=True)
364
#shutil.rmtree('a/.bzr/text-store', ignore_errors=True)
365
self.runbzr('branch a d --basis b')
362
def test_branch_basis(self):
363
# ensure that basis really does grab from the basis by having incomplete source
364
tree = self.make_branch_and_tree('commit_tree')
365
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
367
tree.commit('revision 1', rev_id='1')
368
source = self.make_branch_and_tree('source')
369
# this gives us an incomplete repository
370
tree.bzrdir.open_repository().copy_content_into(source.branch.repository)
371
tree.commit('revision 2', rev_id='2', allow_pointless=True)
372
tree.bzrdir.open_branch().copy_content_into(source.branch)
373
tree.copy_content_into(source)
374
self.assertFalse(source.branch.repository.has_revision('2'))
376
self.runbzr('branch source target --basis commit_tree')
377
target = bzrdir.BzrDir.open('target')
378
self.assertEqual('2', target.open_branch().last_revision())
379
self.assertEqual('2', target.open_workingtree().last_revision())
380
self.assertTrue(target.open_branch().repository.has_revision('2'))
367
382
def test_merge(self):
368
383
from bzrlib.branch import Branch
834
849
"""Test re signing of data."""
835
850
import bzrlib.gpg
836
851
oldstrategy = bzrlib.gpg.GPGStrategy
837
wt = WorkingTree.create_standalone('.')
852
wt = self.make_branch_and_tree('.')
838
853
branch = wt.branch
839
854
wt.commit("base", allow_pointless=True, rev_id='A')
852
867
def test_resign_range(self):
853
868
import bzrlib.gpg
854
869
oldstrategy = bzrlib.gpg.GPGStrategy
855
wt = WorkingTree.create_standalone('.')
870
wt = self.make_branch_and_tree('.')
856
871
branch = wt.branch
857
872
wt.commit("base", allow_pointless=True, rev_id='A')
858
873
wt.commit("base", allow_pointless=True, rev_id='B')
1256
1271
def test_branch(self):
1257
1272
os.mkdir('from')
1258
wt = WorkingTree.create_standalone('from')
1273
wt = self.make_branch_and_tree('from')
1259
1274
branch = wt.branch
1260
1275
wt.commit('empty commit for nonsense', allow_pointless=True)
1261
url = self.get_remote_url('from')
1276
url = self.get_readonly_url('from')
1262
1277
self.run_bzr('branch', url, 'to')
1263
1278
branch = Branch.open('to')
1264
1279
self.assertEqual(1, len(branch.revision_history()))
1280
# the branch should be set in to to from
1281
self.assertEqual(url + '/', branch.get_parent())
1266
1283
def test_log(self):
1267
1284
self.build_tree(['branch/', 'branch/file'])
1268
1285
self.capture('init branch')
1269
1286
self.capture('add branch/file')
1270
1287
self.capture('commit -m foo branch')
1271
url = self.get_remote_url('branch/file')
1288
url = self.get_readonly_url('branch/file')
1272
1289
output = self.capture('log %s' % url)
1273
1290
self.assertEqual(8, len(output.split('\n')))
1277
1294
self.capture('init branch')
1278
1295
self.capture('add branch/file')
1279
1296
self.capture('commit -m foo branch')
1280
url = self.get_remote_url('branch/')
1297
url = self.get_readonly_url('branch/')
1281
1298
self.run_bzr('check', url)