19
19
"""Black-box tests for bzr.
21
21
These check that it behaves properly when it's invoked through the regular
22
command-line interface. This doesn't actually run a new interpreter but
22
command-line interface. This doesn't actually run a new interpreter but
23
23
rather starts again from the run_bzr function.
33
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
34
33
from bzrlib.branch import Branch
34
from bzrlib.errors import BzrCommandError
35
35
from bzrlib.osutils import has_symlinks
36
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
37
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
38
40
class ExternalBase(TestCaseInTempDir):
102
104
self.runbzr("add hello.txt")
103
105
self.runbzr("commit -m added")
107
def test_empty_commit_message(self):
109
file('foo.c', 'wt').write('int main() {}')
110
self.runbzr(['add', 'foo.c'])
111
self.runbzr(["commit", "-m", ""] , retcode=1)
105
113
def test_ignore_patterns(self):
106
114
from bzrlib.branch import Branch
336
344
assert os.path.exists('sub/a.txt.OTHER')
337
345
assert os.path.exists('sub/a.txt.BASE')
339
def test_merge_with_missing_file(self):
340
"""Merge handles missing file conflicts"""
344
print >> file('sub/a.txt', 'wb'), "hello"
345
print >> file('b.txt', 'wb'), "hello"
346
print >> file('sub/c.txt', 'wb'), "hello"
349
self.runbzr(('commit', '-m', 'added a'))
350
self.runbzr('branch . ../b')
351
print >> file('sub/a.txt', 'ab'), "there"
352
print >> file('b.txt', 'ab'), "there"
353
print >> file('sub/c.txt', 'ab'), "there"
354
self.runbzr(('commit', '-m', 'Added there'))
355
os.unlink('sub/a.txt')
356
os.unlink('sub/c.txt')
359
self.runbzr(('commit', '-m', 'Removed a.txt'))
361
print >> file('sub/a.txt', 'ab'), "something"
362
print >> file('b.txt', 'ab'), "something"
363
print >> file('sub/c.txt', 'ab'), "something"
364
self.runbzr(('commit', '-m', 'Modified a.txt'))
365
self.runbzr('merge ../a/')
366
assert os.path.exists('sub/a.txt.THIS')
367
assert os.path.exists('sub/a.txt.BASE')
369
self.runbzr('merge ../b/')
370
assert os.path.exists('sub/a.txt.OTHER')
371
assert os.path.exists('sub/a.txt.BASE')
373
347
def test_pull(self):
374
348
"""Pull changes from one branch to another."""
774
748
progress("skipping symlink tests")
751
class HttpTests(TestCaseWithWebserver):
752
"""Test bzr ui commands against remote branches."""
754
def test_branch(self):
756
branch = Branch.initialize('from')
757
branch.commit('empty commit for nonsense', allow_pointless=True)
758
url = self.get_remote_url('from')
759
self.run_bzr('branch', url, 'to')
760
branch = Branch.open('to')
761
self.assertEqual(1, len(branch.revision_history()))