/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

Eliminate (duplicate) git_ prefix.

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 (
 
25
    ids,
32
26
    tests,
33
27
    )
34
28
 
37
31
 
38
32
    def simple_commit(self):
39
33
        # Create a git repository with a revision.
40
 
        repo = GitRepo.init(self.test_dir)
 
34
        tests.run_git('init')
41
35
        builder = tests.GitBranchBuilder()
42
36
        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]
45
 
 
46
 
    def test_nick(self):
47
 
        GitRepo.init(self.test_dir)
48
 
        dir = BzrDir.open(self.test_dir)
49
 
        dir.create_branch()
50
 
        output, error = self.run_bzr(['nick'])
51
 
        self.assertEquals("HEAD\n", output)
 
37
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
 
38
        builder.finish()
52
39
 
53
40
    def test_info(self):
54
41
        self.simple_commit()
55
42
        output, error = self.run_bzr(['info'])
56
43
        self.assertEqual(error, '')
57
 
        self.assertTrue("Standalone tree (format: git)" in output)
 
44
        self.assertTrue("Repository tree (format: git)" in output)
58
45
 
59
46
    def test_branch(self):
60
47
        os.mkdir("gitbranch")
61
 
        GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
62
 
        os.chdir('gitbranch')
 
48
        os.chdir("gitbranch")
 
49
        tests.run_git('init')
63
50
        builder = tests.GitBranchBuilder()
64
51
        builder.set_file('a', 'text for a\n', False)
65
52
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
66
53
        builder.finish()
67
 
        os.chdir('..')
68
54
 
 
55
        os.chdir("..")
69
56
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
70
57
        self.assertEqual(error, 'Branched 1 revision(s).\n')
 
58
        self.assertEqual(output, '')
71
59
 
72
60
    def test_branch_ls(self):
73
61
        self.simple_commit()
75
63
        self.assertEqual(error, '')
76
64
        self.assertEqual(output, "a\n")
77
65
 
78
 
    def test_init(self):
79
 
        self.run_bzr("init-repo --git repo") 
80
 
 
81
66
    def test_info_verbose(self):
82
67
        self.simple_commit()
83
68
 
84
69
        output, error = self.run_bzr(['info', '-v'])
85
70
        self.assertEqual(error, '')
86
 
        self.assertTrue("Standalone tree (format: git)" in output)
 
71
        self.assertTrue("Repository tree (format: git)" in output)
87
72
        self.assertTrue("control: Local Git Repository" in output)
88
73
        self.assertTrue("branch: Git Branch" in output)
89
74
        self.assertTrue("repository: Git Repository" in output)
90
75
 
91
 
    def test_push(self):
92
 
        os.mkdir("bla")
93
 
        GitRepo.init(os.path.join(self.test_dir, "bla"))
94
 
        self.run_bzr(['init', 'foo'])
95
 
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
96
 
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
97
 
        self.assertEquals("", output)
98
 
        self.assertTrue(error.endswith("Created new branch.\n"))
99
 
 
100
76
    def test_log(self):
101
77
        # Smoke test for "bzr log" in a git repository.
102
78
        self.simple_commit()
116
92
        output, error = self.run_bzr(['log', '-v'])
117
93
 
118
94
    def test_tags(self):
119
 
        git_repo, commit_sha1 = self.simple_commit()
120
 
        git_repo.refs["refs/tags/foo"] = commit_sha1
 
95
        self.simple_commit()
 
96
 
 
97
        tests.run_git("tag", "foo")
121
98
 
122
99
        output, error = self.run_bzr(['tags'])
123
100
        self.assertEquals(error, '')
124
101
        self.assertEquals(output, "foo                  1\n")
125
102
 
126
103
    def test_tag(self):
 
104
        raise KnownFailure("setting tags not supported by git-python yet")
127
105
        self.simple_commit()
128
106
 
129
107
        output, error = self.run_bzr(["tag", "bar"])
130
108
 
131
109
        self.assertEquals(error, '')
132
 
        self.assertEquals(output, 'Created tag bar.\n')
133
 
 
134
 
    def test_init_repo(self):
135
 
        output, error = self.run_bzr(["init-repo", "--git", "bla.git"])
136
 
        self.assertEquals(error, '')
137
 
        self.assertEquals(output, 'Unshared repository with trees (format: git)\nLocation:\n  repository: bla.git\n')
 
110
        self.assertEquals(output, '')
138
111