17
17
"""Test the GitDir class"""
19
from dulwich.repo import Repo as GitRepo
25
from bzrlib.tests import TestSkipped
27
from bzrlib.plugins.git import (
21
from bzrlib import bzrdir
23
from bzrlib.plugins.git import tests
24
from bzrlib.plugins.git import git_dir
34
27
class TestGitDir(tests.TestCaseInTempDir):
29
_test_needs_features = [tests.GitCommandFeature]
36
31
def test_open_existing(self):
39
gd = bzrdir.BzrDir.open('.')
40
self.assertIsInstance(gd, dir.LocalGitDir)
42
def test_open_workingtree(self):
45
gd = bzrdir.BzrDir.open('.')
47
wt = gd.open_workingtree()
48
self.assertIsInstance(wt, workingtree.GitWorkingTree)
50
def test_open_workingtree_bare(self):
51
GitRepo.init_bare(".")
53
gd = bzrdir.BzrDir.open('.')
54
self.assertRaises(errors.NoWorkingTree, gd.open_workingtree)
57
class TestGitDirFormat(tests.TestCase):
60
super(TestGitDirFormat, self).setUp()
61
self.format = dir.LocalGitControlDirFormat()
63
def test_get_format_description(self):
64
self.assertEquals("Local Git Repository",
65
self.format.get_format_description())
68
format2 = dir.LocalGitControlDirFormat()
69
self.assertEquals(self.format, format2)
70
self.assertEquals(self.format, self.format)
71
bzr_format = bzrdir.format_registry.make_bzrdir("default")
72
self.assertNotEquals(self.format, bzr_format)
34
gd = bzrdir.BzrDir.open('.')
35
self.assertIsInstance(gd, git_dir.GitDir)