46
46
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
47
47
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
48
48
from bzrlib.tests.blackbox import ExternalBase
49
from bzrlib.workingtree import WorkingTree
51
52
class TestCommands(ExternalBase):
164
165
self.runbzr('commit -m newstuff branch', retcode=3)
166
167
def test_ignore_patterns(self):
167
from bzrlib.branch import Branch
168
Branch.initialize('.')
169
169
self.assertEquals(self.capture('unknowns'), '')
171
171
file('foo.tmp', 'wt').write('tmp files are ignored')
260
260
def test_mv_modes(self):
261
261
"""Test two modes of operation for mv"""
262
from bzrlib.branch import Branch
263
b = Branch.initialize('.')
264
263
self.build_tree(['a', 'c', 'subdir/'])
265
264
self.run_bzr_captured(['add', self.test_dir])
266
265
self.run_bzr_captured(['mv', 'a', 'b'])
634
633
def test_add_reports(self):
635
634
"""add command prints the names of added files."""
636
b = Branch.initialize('.')
637
636
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
638
637
out = self.run_bzr_captured(['add'], retcode=0)[0]
639
638
# the ordering is not defined at the moment
655
654
def test_add_quiet_is(self):
656
655
"""add -q does not print the names of added files."""
657
b = Branch.initialize('.')
658
657
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
659
658
out = self.run_bzr_captured(['add', '-q'], retcode=0)[0]
660
659
# the ordering is not defined at the moment
667
666
"bzr add" should add the parent(s) as necessary.
669
from bzrlib.branch import Branch
670
Branch.initialize('.')
671
669
self.build_tree(['inertiatic/', 'inertiatic/esp'])
672
670
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
673
671
self.run_bzr('add', 'inertiatic/esp')
691
689
"bzr add" should do this happily.
693
from bzrlib.branch import Branch
694
Branch.initialize('.')
695
692
self.build_tree(['inertiatic/', 'inertiatic/esp'])
696
693
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
697
694
self.run_bzr('add', '--no-recurse', 'inertiatic')
702
699
def test_subdir_add(self):
703
700
"""Add in subdirectory should add only things from there down"""
704
from bzrlib.branch import Branch
701
from bzrlib.workingtree import WorkingTree
706
703
eq = self.assertEqual
707
704
ass = self.assert_
710
b = Branch.initialize('.')
707
t = WorkingTree.create_standalone('.')
712
709
self.build_tree(['src/', 'README'])
714
711
eq(sorted(t.unknowns()),
837
834
"""Test re signing of data."""
838
835
import bzrlib.gpg
839
836
oldstrategy = bzrlib.gpg.GPGStrategy
840
branch = Branch.initialize('.')
841
branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
837
wt = WorkingTree.create_standalone('.')
839
wt.commit("base", allow_pointless=True, rev_id='A')
843
841
# monkey patch gpg signing mechanism
844
842
from bzrlib.testament import Testament
854
852
def test_resign_range(self):
855
853
import bzrlib.gpg
856
854
oldstrategy = bzrlib.gpg.GPGStrategy
857
branch = Branch.initialize('.')
858
branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
859
branch.working_tree().commit("base", allow_pointless=True, rev_id='B')
860
branch.working_tree().commit("base", allow_pointless=True, rev_id='C')
855
wt = WorkingTree.create_standalone('.')
857
wt.commit("base", allow_pointless=True, rev_id='A')
858
wt.commit("base", allow_pointless=True, rev_id='B')
859
wt.commit("base", allow_pointless=True, rev_id='C')
862
861
# monkey patch gpg signing mechanism
863
862
from bzrlib.testament import Testament
1257
1256
def test_branch(self):
1258
1257
os.mkdir('from')
1259
branch = Branch.initialize('from')
1260
branch.working_tree().commit('empty commit for nonsense', allow_pointless=True)
1258
wt = WorkingTree.create_standalone('from')
1260
wt.commit('empty commit for nonsense', allow_pointless=True)
1261
1261
url = self.get_remote_url('from')
1262
1262
self.run_bzr('branch', url, 'to')
1263
1263
branch = Branch.open('to')
1266
1266
def test_log(self):
1267
1267
self.build_tree(['branch/', 'branch/file'])
1268
branch = Branch.initialize('branch')
1269
branch.working_tree().add(['file'])
1270
branch.working_tree().commit('add file', rev_id='A')
1268
self.capture('init branch')
1269
self.capture('add branch/file')
1270
self.capture('commit -m foo branch')
1271
1271
url = self.get_remote_url('branch/file')
1272
1272
output = self.capture('log %s' % url)
1273
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')
1283
1275
def test_check(self):
1284
1276
self.build_tree(['branch/', 'branch/file'])
1285
branch = Branch.initialize('branch')
1286
branch.working_tree().add(['file'])
1287
branch.working_tree().commit('add file', rev_id='A')
1277
self.capture('init branch')
1278
self.capture('add branch/file')
1279
self.capture('commit -m foo branch')
1288
1280
url = self.get_remote_url('branch/')
1289
1281
self.run_bzr('check', url)