43
43
from bzrlib.branch import Branch
44
from bzrlib.clone import copy_branch
45
44
from bzrlib.errors import BzrCommandError
46
45
from bzrlib.osutils import has_symlinks, pathjoin
47
46
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
48
47
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
49
48
from bzrlib.tests.blackbox import ExternalBase
51
51
class TestCommands(ExternalBase):
53
53
def test_help_commands(self):
395
395
# Merging a branch pulls its revision into the tree
396
396
a = Branch.open('.')
397
397
b = Branch.open('../b')
398
a.get_revision_xml(b.last_revision())
398
a.repository.get_revision_xml(b.last_revision())
399
399
self.log('pending merges: %s', a.working_tree().pending_merges())
400
400
self.assertEquals(a.working_tree().pending_merges(),
401
401
[b.last_revision()])
559
file("myfile", "wb").write("My contents\n")
561
self.runbzr('commit -m myfile')
562
self.run_bzr_captured('cat -r 1 myfile'.split(' '))
557
564
def test_pull_verbose(self):
558
565
"""Pull changes from one branch to another and watch the output."""
781
788
self.runbzr('commit -m done',)
782
789
self.runbzr('remerge', retcode=3)
791
def test_status(self):
795
self.runbzr('commit --unchanged --message f')
796
self.runbzr('branch . ../branch2')
797
self.runbzr('branch . ../branch3')
798
self.runbzr('commit --unchanged --message peter')
799
os.chdir('../branch2')
800
self.runbzr('merge ../branch1')
801
self.runbzr('commit --unchanged --message pumpkin')
802
os.chdir('../branch3')
803
self.runbzr('merge ../branch2')
804
message = self.capture('status')
785
807
def test_conflicts(self):
786
808
"""Handling of merge conflicts"""
822
844
from bzrlib.testament import Testament
823
845
bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
824
846
self.runbzr('re-sign -r revid:A')
825
self.assertEqual(Testament.from_revision(branch,'A').as_short_text(),
826
branch.revision_store.get('A', 'sig').read())
847
self.assertEqual(Testament.from_revision(branch.repository,
848
'A').as_short_text(),
849
branch.repository.revision_store.get('A',
828
852
bzrlib.gpg.GPGStrategy = oldstrategy
839
863
from bzrlib.testament import Testament
840
864
bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
841
865
self.runbzr('re-sign -r 1..')
842
self.assertEqual(Testament.from_revision(branch,'A').as_short_text(),
843
branch.revision_store.get('A', 'sig').read())
844
self.assertEqual(Testament.from_revision(branch,'B').as_short_text(),
845
branch.revision_store.get('B', 'sig').read())
846
self.assertEqual(Testament.from_revision(branch,'C').as_short_text(),
847
branch.revision_store.get('C', 'sig').read())
867
Testament.from_revision(branch.repository,'A').as_short_text(),
868
branch.repository.revision_store.get('A', 'sig').read())
870
Testament.from_revision(branch.repository,'B').as_short_text(),
871
branch.repository.revision_store.get('B', 'sig').read())
872
self.assertEqual(Testament.from_revision(branch.repository,
873
'C').as_short_text(),
874
branch.repository.revision_store.get('C',
849
877
bzrlib.gpg.GPGStrategy = oldstrategy
1243
1271
url = self.get_remote_url('branch/file')
1244
1272
output = self.capture('log %s' % url)
1245
1273
self.assertEqual(8, len(output.split('\n')))
1274
# FIXME: rbc 20051128 what is the remainder of this test testing?
1275
# - it does not seem to be http specific.
1276
copy = branch.clone('branch2')
1277
branch.working_tree().commit(message='empty commit')
1279
self.run_bzr('merge', '../branch')
1280
copy.working_tree().commit(message='merge')
1281
output = self.capture('log')
1247
1283
def test_check(self):
1248
1284
self.build_tree(['branch/', 'branch/file'])