/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_blackbox.py

Detect smart servers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import os
24
24
 
 
25
from bzrlib import (
 
26
    version_info as bzrlib_version,
 
27
    )
25
28
from bzrlib.bzrdir import (
26
29
    BzrDir,
27
30
    )
28
31
 
29
32
from bzrlib.tests.blackbox import ExternalBase
 
33
from bzrlib.tests import KnownFailure
30
34
 
31
35
from bzrlib.plugins.git import (
32
36
    tests,
48
52
        dir = BzrDir.open(self.test_dir)
49
53
        dir.create_branch()
50
54
        output, error = self.run_bzr(['nick'])
51
 
        self.assertEquals("HEAD\n", output)
 
55
        self.assertEquals("master\n", output)
52
56
 
53
57
    def test_info(self):
54
58
        self.simple_commit()
69
73
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
70
74
        self.assertEqual(error, 'Branched 1 revision(s).\n')
71
75
 
 
76
    def test_checkout(self):
 
77
        os.mkdir("gitbranch")
 
78
        GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
 
79
        os.chdir('gitbranch')
 
80
        builder = tests.GitBranchBuilder()
 
81
        builder.set_file('a', 'text for a\n', False)
 
82
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
 
83
        builder.finish()
 
84
        os.chdir('..')
 
85
 
 
86
        output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch'])
 
87
        self.assertEqual(error, '')
 
88
        self.assertEqual(output, '')
 
89
 
72
90
    def test_branch_ls(self):
73
91
        self.simple_commit()
74
92
        output, error = self.run_bzr(['ls', '-r-1'])
76
94
        self.assertEqual(output, "a\n")
77
95
 
78
96
    def test_init(self):
79
 
        self.run_bzr("init-repo --git repo") 
 
97
        self.run_bzr("init --git repo")
80
98
 
81
99
    def test_info_verbose(self):
82
100
        self.simple_commit()
83
101
 
 
102
        if bzrlib_version < (2, 4):
 
103
            raise KnownFailure("bzr info uses inventory on bzr < 2.4")
 
104
 
84
105
        output, error = self.run_bzr(['info', '-v'])
85
106
        self.assertEqual(error, '')
86
107
        self.assertTrue("Standalone tree (format: git)" in output)
88
109
        self.assertTrue("branch: Git Branch" in output)
89
110
        self.assertTrue("repository: Git Repository" in output)
90
111
 
91
 
    def test_push(self):
 
112
    def test_push_roundtripping(self):
 
113
        raise KnownFailure("roundtripping is not yet supported")
 
114
        self.with_roundtripping()
92
115
        os.mkdir("bla")
93
116
        GitRepo.init(os.path.join(self.test_dir, "bla"))
94
117
        self.run_bzr(['init', 'foo'])
95
118
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
 
119
        # when roundtripping is supported
96
120
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
97
121
        self.assertEquals("", output)
98
122
        self.assertTrue(error.endswith("Created new branch.\n"))
128
152
 
129
153
        output, error = self.run_bzr(["tag", "bar"])
130
154
 
131
 
        self.assertEquals(error, '')
132
 
        self.assertEquals(output, 'Created tag bar.\n')
 
155
        # bzr <= 2.2 emits this message in the output stream
 
156
        # bzr => 2.3 emits this message in the error stream
 
157
        self.assertEquals(error + output, 'Created tag bar.\n')
133
158
 
134
159
    def test_init_repo(self):
135
 
        output, error = self.run_bzr(["init-repo", "--git", "bla.git"])
 
160
        output, error = self.run_bzr(["init", "--git", "bla.git"])
136
161
        self.assertEquals(error, '')
137
 
        self.assertEquals(output, 'Unshared repository with trees (format: git)\nLocation:\n  repository: bla.git\n')
 
162
        self.assertEquals(output, 'Created a standalone tree (format: git)\n')
138
163
 
 
164
    def test_diff_format(self):
 
165
        tree = self.make_branch_and_tree('.')
 
166
        self.build_tree(['a'])
 
167
        tree.add(['a'])
 
168
        output, error = self.run_bzr(['diff', '--format=git'], retcode=1)
 
169
        self.assertEqual(error, '')
 
170
        self.assertEqual(output,
 
171
            'diff --git /dev/null b/a\n'
 
172
            'old mode 0\n'
 
173
            'new mode 100644\n'
 
174
            'index 0000000..c197bd8 100644\n'
 
175
            '--- /dev/null\n'
 
176
            '+++ b/a\n'
 
177
            '@@ -1,0 +1,1 @@\n'
 
178
            '+contents of a\n')