/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_repository.py

Rely less on command-line git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for interfacing with a Git Repository"""
18
18
 
19
19
import dulwich
 
20
from dulwich.repo import (
 
21
    Repo as GitRepo,
 
22
    )
20
23
import os
21
24
 
22
25
from bzrlib import (
47
50
    _test_needs_features = [tests.GitCommandFeature]
48
51
 
49
52
    def test_open_existing(self):
50
 
        tests.run_git('init')
 
53
        GitRepo.init(self.test_dir)
51
54
 
52
55
        repo = Repository.open('.')
53
56
        self.assertIsInstance(repo, repository.GitRepository)
54
57
 
55
58
    def test_has_git_repo(self):
56
 
        tests.run_git('init')
 
59
        GitRepo.init(self.test_dir)
57
60
 
58
61
        repo = Repository.open('.')
59
62
        self.assertIsInstance(repo._git, dulwich.repo.Repo)
62
65
        # GitRepository.get_revision gives a Revision object.
63
66
 
64
67
        # Create a git repository with a revision.
65
 
        tests.run_git('init')
 
68
        GitRepo.init(self.test_dir)
66
69
        builder = tests.GitBranchBuilder()
67
70
        builder.set_file('a', 'text for a\n', False)
68
71
        commit_handle = builder.commit('Joe Foo <joe@foo.com>', u'message')
76
79
        self.assertIsInstance(rev, revision.Revision)
77
80
 
78
81
    def test_get_revision_unknown(self):
79
 
        tests.run_git('init')
 
82
        GitRepo.init(self.test_dir)
80
83
 
81
84
        repo = Repository.open('.')
82
85
        self.assertRaises(errors.NoSuchRevision, repo.get_revision, "bla")
83
86
 
84
87
    def simple_commit(self):
85
88
        # Create a git repository with some interesting files in a revision.
86
 
        tests.run_git('init')
 
89
        GitRepo.init(self.test_dir)
87
90
        builder = tests.GitBranchBuilder()
88
91
        builder.set_file('data', 'text\n', False)
89
92
        builder.set_file('executable', 'content', True)