/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

Implement GitRepository.revision_graph_can_have_wrong_parents().

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
 
19
23
import os
20
24
 
21
25
from bzrlib.tests import KnownFailure
30
34
 
31
35
    def simple_commit(self):
32
36
        # Create a git repository with a revision.
33
 
        tests.run_git('init')
 
37
        repo = GitRepo.init(self.test_dir)
34
38
        builder = tests.GitBranchBuilder()
35
39
        builder.set_file('a', 'text for a\n', False)
36
 
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
37
 
        builder.finish()
 
40
        r1 = builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
 
41
        return repo, builder.finish()[r1]
38
42
 
39
43
    def test_nick(self):
40
 
        tests.run_git('init')
 
44
        GitRepo.init(self.test_dir)
41
45
        output, error = self.run_bzr(['nick'])
42
46
        self.assertEquals("HEAD\n", output)
43
47
 
49
53
 
50
54
    def test_branch(self):
51
55
        os.mkdir("gitbranch")
52
 
        os.chdir("gitbranch")
53
 
        tests.run_git('init')
 
56
        GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
 
57
        os.chdir('gitbranch')
54
58
        builder = tests.GitBranchBuilder()
55
59
        builder.set_file('a', 'text for a\n', False)
56
60
        builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>')
57
61
        builder.finish()
 
62
        os.chdir('..')
58
63
 
59
 
        os.chdir("..")
60
64
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
61
65
        self.assertEqual(error, 'Branched 1 revision(s).\n')
62
66
 
81
85
 
82
86
    def test_push(self):
83
87
        os.mkdir("bla")
84
 
        os.chdir("bla")
85
 
        tests.run_git("init")
86
 
        os.chdir("..")
 
88
        GitRepo.init(os.path.join(self.test_dir, "bla"))
87
89
        self.run_bzr(['init', 'foo'])
88
90
        self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
89
91
        output, error = self.run_bzr(['push', '-d', 'foo', 'bla'], retcode=3)
109
111
        output, error = self.run_bzr(['log', '-v'])
110
112
 
111
113
    def test_tags(self):
112
 
        self.simple_commit()
113
 
 
114
 
        tests.run_git("tag", "foo")
 
114
        git_repo, commit_sha1 = self.simple_commit()
 
115
        git_repo.refs["refs/tags/foo"] = commit_sha1
115
116
 
116
117
        output, error = self.run_bzr(['tags'])
117
118
        self.assertEquals(error, '')