/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

merge new bzr-foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Black-box tests for bzr-git."""
18
18
 
19
 
from dulwich.repo import (
20
 
    Repo as GitRepo,
21
 
    )
22
 
 
23
19
import os
24
20
 
25
 
from bzrlib.bzrdir import (
26
 
    BzrDir,
27
 
    )
28
 
 
 
21
from bzrlib.tests import KnownFailure
29
22
from bzrlib.tests.blackbox import ExternalBase
30
23
 
31
24
from bzrlib.plugins.git import (
37
30
 
38
31
    def simple_commit(self):
39
32
        # Create a git repository with a revision.
40
 
        repo = GitRepo.init(self.test_dir)
 
33
        tests.run_git('init')
41
34
        builder = tests.GitBranchBuilder()
42
35
        builder.set_file('a', 'text for a\n', False)
43
 
        r1 = builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
44
 
        return repo, builder.finish()[r1]
 
36
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
 
37
        builder.finish()
45
38
 
46
39
    def test_nick(self):
47
 
        GitRepo.init(self.test_dir)
48
 
        dir = BzrDir.open(self.test_dir)
49
 
        dir.create_branch()
 
40
        tests.run_git('init')
50
41
        output, error = self.run_bzr(['nick'])
51
42
        self.assertEquals("HEAD\n", output)
52
43
 
54
45
        self.simple_commit()
55
46
        output, error = self.run_bzr(['info'])
56
47
        self.assertEqual(error, '')
57
 
        self.assertTrue("Standalone tree (format: git)" in output)
 
48
        self.assertTrue("Repository branch (format: git)" in output)
58
49
 
59
50
    def test_branch(self):
60
51
        os.mkdir("gitbranch")
61
 
        GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
62
 
        os.chdir('gitbranch')
 
52
        os.chdir("gitbranch")
 
53
        tests.run_git('init')
63
54
        builder = tests.GitBranchBuilder()
64
55
        builder.set_file('a', 'text for a\n', False)
65
56
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
66
57
        builder.finish()
67
 
        os.chdir('..')
68
58
 
 
59
        os.chdir("..")
69
60
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
70
61
        self.assertEqual(error, 'Branched 1 revision(s).\n')
71
62
 
83
74
 
84
75
        output, error = self.run_bzr(['info', '-v'])
85
76
        self.assertEqual(error, '')
86
 
        self.assertTrue("Standalone tree (format: git)" in output)
 
77
        self.assertTrue("Repository branch (format: git)" in output)
87
78
        self.assertTrue("control: Local Git Repository" in output)
88
79
        self.assertTrue("branch: Git Branch" in output)
89
80
        self.assertTrue("repository: Git Repository" in output)
90
81
 
91
82
    def test_push(self):
92
83
        os.mkdir("bla")
93
 
        GitRepo.init(os.path.join(self.test_dir, "bla"))
 
84
        os.chdir("bla")
 
85
        tests.run_git("init")
 
86
        os.chdir("..")
94
87
        self.run_bzr(['init', 'foo'])
95
88
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
96
 
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
 
89
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'], retcode=3)
 
90
        self.assertEquals('bzr: ERROR: Push is not yet supported for bzr-git. Try dpush instead.\n', error)
97
91
        self.assertEquals("", output)
98
 
        self.assertTrue(error.endswith("Created new branch.\n"))
99
92
 
100
93
    def test_log(self):
101
94
        # Smoke test for "bzr log" in a git repository.
116
109
        output, error = self.run_bzr(['log', '-v'])
117
110
 
118
111
    def test_tags(self):
119
 
        git_repo, commit_sha1 = self.simple_commit()
120
 
        git_repo.refs["refs/tags/foo"] = commit_sha1
 
112
        self.simple_commit()
 
113
 
 
114
        tests.run_git("tag", "foo")
121
115
 
122
116
        output, error = self.run_bzr(['tags'])
123
117
        self.assertEquals(error, '')
134
128
    def test_init_repo(self):
135
129
        output, error = self.run_bzr(["init-repo", "--git", "bla.git"])
136
130
        self.assertEquals(error, '')
137
 
        self.assertEquals(output, 'Unshared repository with trees (format: git)\nLocation:\n  repository: bla.git\n')
 
131
        self.assertEquals(output, 'Repository branch (format: git)\nLocation:\n  shared repository: bla.git\n  repository branch: bla.git\n')
138
132