/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 test fixes.

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
 
 
35
from bzrlib.plugins.git.mapping import mapping_registry
31
36
from bzrlib.plugins.git import (
32
37
    tests,
33
38
    )
48
53
        dir = BzrDir.open(self.test_dir)
49
54
        dir.create_branch()
50
55
        output, error = self.run_bzr(['nick'])
51
 
        self.assertEquals("HEAD\n", output)
 
56
        self.assertEquals("master\n", output)
52
57
 
53
58
    def test_info(self):
54
59
        self.simple_commit()
69
74
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
70
75
        self.assertEqual(error, 'Branched 1 revision(s).\n')
71
76
 
 
77
    def test_checkout(self):
 
78
        os.mkdir("gitbranch")
 
79
        GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
 
80
        os.chdir('gitbranch')
 
81
        builder = tests.GitBranchBuilder()
 
82
        builder.set_file('a', 'text for a\n', False)
 
83
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
 
84
        builder.finish()
 
85
        os.chdir('..')
 
86
 
 
87
        output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch'])
 
88
        self.assertEqual(error, '')
 
89
        self.assertEqual(output, '')
 
90
 
72
91
    def test_branch_ls(self):
73
92
        self.simple_commit()
74
93
        output, error = self.run_bzr(['ls', '-r-1'])
76
95
        self.assertEqual(output, "a\n")
77
96
 
78
97
    def test_init(self):
79
 
        self.run_bzr("init-repo --git repo") 
 
98
        self.run_bzr("init --git repo")
80
99
 
81
100
    def test_info_verbose(self):
82
101
        self.simple_commit()
83
102
 
 
103
        if bzrlib_version < (2, 4):
 
104
            raise KnownFailure("bzr info uses inventory on bzr < 2.4")
 
105
 
84
106
        output, error = self.run_bzr(['info', '-v'])
85
107
        self.assertEqual(error, '')
86
108
        self.assertTrue("Standalone tree (format: git)" in output)
88
110
        self.assertTrue("branch: Git Branch" in output)
89
111
        self.assertTrue("repository: Git Repository" in output)
90
112
 
91
 
    def test_push(self):
 
113
    def with_roundtripping(self):
 
114
        self.addCleanup(mapping_registry.set_default, mapping_registry.get().revid_prefix)
 
115
        mapping_registry.set_default('git-experimental')
 
116
 
 
117
    def test_push_roundtripping(self):
 
118
        self.with_roundtripping()
92
119
        os.mkdir("bla")
93
120
        GitRepo.init(os.path.join(self.test_dir, "bla"))
94
121
        self.run_bzr(['init', 'foo'])
95
122
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
 
123
        # when roundtripping is supported
96
124
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
97
125
        self.assertEquals("", output)
98
126
        self.assertTrue(error.endswith("Created new branch.\n"))
128
156
 
129
157
        output, error = self.run_bzr(["tag", "bar"])
130
158
 
131
 
        self.assertEquals(error, '')
132
 
        self.assertEquals(output, 'Created tag bar.\n')
 
159
        # bzr <= 2.2 emits this message in the output stream
 
160
        # bzr => 2.3 emits this message in the error stream
 
161
        self.assertEquals(error + output, 'Created tag bar.\n')
133
162
 
134
163
    def test_init_repo(self):
135
 
        output, error = self.run_bzr(["init-repo", "--git", "bla.git"])
 
164
        output, error = self.run_bzr(["init", "--git", "bla.git"])
136
165
        self.assertEquals(error, '')
137
 
        self.assertEquals(output, 'Unshared repository with trees (format: git)\nLocation:\n  repository: bla.git\n')
 
166
        self.assertEquals(output, 'Created a standalone tree (format: git)\n')
138
167