~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2005-10-08 04:01:04 UTC
  • mfrom: (1423)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1425.
  • Revision ID: aaron.bentley@utoronto.ca-20051008040104-1c604843ae42de07
MergeĀ fromĀ Robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""Black-box tests for bzr.
20
20
 
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.
24
24
"""
25
25
 
30
30
import sys
31
31
import os
32
32
 
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
36
38
 
37
39
 
38
40
class ExternalBase(TestCaseInTempDir):
102
104
        self.runbzr("add hello.txt")
103
105
        self.runbzr("commit -m added")
104
106
 
 
107
    def test_empty_commit_message(self):
 
108
        self.runbzr("init")
 
109
        file('foo.c', 'wt').write('int main() {}')
 
110
        self.runbzr(['add', 'foo.c'])
 
111
        self.runbzr(["commit", "-m", ""] , retcode=1) 
 
112
 
105
113
    def test_ignore_patterns(self):
106
114
        from bzrlib.branch import Branch
107
115
        
336
344
        assert os.path.exists('sub/a.txt.OTHER')
337
345
        assert os.path.exists('sub/a.txt.BASE')
338
346
 
339
 
    def test_merge_with_missing_file(self):
340
 
        """Merge handles missing file conflicts"""
341
 
        os.mkdir('a')
342
 
        os.chdir('a')
343
 
        os.mkdir('sub')
344
 
        print >> file('sub/a.txt', 'wb'), "hello"
345
 
        print >> file('b.txt', 'wb'), "hello"
346
 
        print >> file('sub/c.txt', 'wb'), "hello"
347
 
        self.runbzr('init')
348
 
        self.runbzr('add')
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')
357
 
        os.rmdir('sub')
358
 
        os.unlink('b.txt')
359
 
        self.runbzr(('commit', '-m', 'Removed a.txt'))
360
 
        os.chdir('../b')
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')
368
 
        os.chdir('../a')
369
 
        self.runbzr('merge ../b/')
370
 
        assert os.path.exists('sub/a.txt.OTHER')
371
 
        assert os.path.exists('sub/a.txt.BASE')
372
 
 
373
347
    def test_pull(self):
374
348
        """Pull changes from one branch to another."""
375
349
        os.mkdir('a')
772
746
            chdir("..")
773
747
        else:
774
748
            progress("skipping symlink tests")
775
 
            
 
749
 
 
750
 
 
751
class HttpTests(TestCaseWithWebserver):
 
752
    """Test bzr ui commands against remote branches."""
 
753
 
 
754
    def test_branch(self):
 
755
        os.mkdir('from')
 
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()))