/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

More work on roundtrip push support.

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
 
    )
28
25
from bzrlib.bzrdir import (
29
26
    BzrDir,
30
27
    )
31
28
 
32
29
from bzrlib.tests.blackbox import ExternalBase
33
 
from bzrlib.tests import KnownFailure
34
30
 
35
31
from bzrlib.plugins.git import (
36
32
    tests,
52
48
        dir = BzrDir.open(self.test_dir)
53
49
        dir.create_branch()
54
50
        output, error = self.run_bzr(['nick'])
55
 
        self.assertEquals("master\n", output)
 
51
        self.assertEquals("HEAD\n", output)
56
52
 
57
53
    def test_info(self):
58
54
        self.simple_commit()
73
69
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
74
70
        self.assertEqual(error, 'Branched 1 revision(s).\n')
75
71
 
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
 
 
90
72
    def test_branch_ls(self):
91
73
        self.simple_commit()
92
74
        output, error = self.run_bzr(['ls', '-r-1'])
94
76
        self.assertEqual(output, "a\n")
95
77
 
96
78
    def test_init(self):
97
 
        self.run_bzr("init --git repo")
 
79
        self.run_bzr("init-repo --git repo") 
98
80
 
99
81
    def test_info_verbose(self):
100
82
        self.simple_commit()
101
83
 
102
 
        if bzrlib_version < (2, 4):
103
 
            raise KnownFailure("bzr info uses inventory on bzr < 2.4")
104
 
 
105
84
        output, error = self.run_bzr(['info', '-v'])
106
85
        self.assertEqual(error, '')
107
86
        self.assertTrue("Standalone tree (format: git)" in output)
109
88
        self.assertTrue("branch: Git Branch" in output)
110
89
        self.assertTrue("repository: Git Repository" in output)
111
90
 
112
 
    def test_push_roundtripping(self):
113
 
        raise KnownFailure("roundtripping is not yet supported")
114
 
        self.with_roundtripping()
 
91
    def test_push(self):
115
92
        os.mkdir("bla")
116
93
        GitRepo.init(os.path.join(self.test_dir, "bla"))
117
94
        self.run_bzr(['init', 'foo'])
118
95
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
119
 
        # when roundtripping is supported
120
96
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
121
97
        self.assertEquals("", output)
122
98
        self.assertTrue(error.endswith("Created new branch.\n"))
152
128
 
153
129
        output, error = self.run_bzr(["tag", "bar"])
154
130
 
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')
 
131
        self.assertEquals(error, '')
 
132
        self.assertEquals(output, 'Created tag bar.\n')
158
133
 
159
134
    def test_init_repo(self):
160
 
        output, error = self.run_bzr(["init", "--git", "bla.git"])
 
135
        output, error = self.run_bzr(["init-repo", "--git", "bla.git"])
161
136
        self.assertEquals(error, '')
162
 
        self.assertEquals(output, 'Created a standalone tree (format: git)\n')
 
137
        self.assertEquals(output, 'Unshared repository with trees (format: git)\nLocation:\n  repository: bla.git\n')
163
138
 
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')