/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_shamap.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
"""Tests for GitShaMap."""
18
18
 
19
 
from bzrlib.tests import TestCase
 
19
import os
 
20
 
 
21
from bzrlib.tests import (
 
22
    TestCase,
 
23
    TestCaseInTempDir,
 
24
    UnavailableFeature,
 
25
    )
20
26
 
21
27
from bzrlib.plugins.git.shamap import (
22
28
    DictGitShaMap,
23
29
    SqliteGitShaMap,
 
30
    TdbGitShaMap,
24
31
    )
25
32
 
26
33
class TestGitShaMap:
37
44
            self.map.lookup_git_sha, "5686645d49063c73d35436192dfc9a160c672301")
38
45
        
39
46
    def test_blob(self):
40
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
41
 
            "blob", ("myfileid", "myrevid"))
 
47
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
 
48
        self.map.add_entry(thesha, "blob", ("myfileid", "myrevid"))
42
49
        self.assertEquals(
43
50
            ("blob", ("myfileid", "myrevid")),
44
 
            self.map.lookup_git_sha("5686645d49063c73d35436192dfc9a160c672301"))
 
51
            self.map.lookup_git_sha(thesha))
 
52
        self.assertEquals(thesha, self.map.lookup_blob("myfileid", "myrevid"))
45
53
 
46
54
    def test_tree(self):
47
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
 
55
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
 
56
        self.map.add_entry(thesha, 
48
57
            "tree", ("somepath", "myrevid"))
49
58
        self.assertEquals(
50
59
            ("tree", ("somepath", "myrevid")),
51
 
            self.map.lookup_git_sha("5686645d49063c73d35436192dfc9a160c672301"))
 
60
            self.map.lookup_git_sha(thesha))
 
61
        self.assertEquals(thesha, self.map.lookup_tree("somepath", "myrevid"))
52
62
 
53
63
    def test_revids(self):
54
64
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
69
79
        TestCase.setUp(self)
70
80
        self.map = SqliteGitShaMap()
71
81
 
 
82
 
 
83
class TdbGitShaMapTests(TestCaseInTempDir,TestGitShaMap):
 
84
 
 
85
    def setUp(self):
 
86
        TestCaseInTempDir.setUp(self)
 
87
        try:
 
88
            self.map = TdbGitShaMap(os.path.join(self.test_dir, 'foo.tdb'))
 
89
        except ImportError:
 
90
            raise UnavailableFeature("Missing tdb")