/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

  • Committer: Jelmer Vernooij
  • Date: 2010-02-12 00:39:11 UTC
  • mto: (0.200.718 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100212003911-hz63ctlfgsvrzrjh
Cope with has_index not existing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
class TestGitShaMap:
34
34
 
35
35
    def test_commit(self):
36
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
 
36
        self.map.start_write_group()
 
37
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301",
37
38
            "commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba"))
 
39
        self.map.commit_write_group()
38
40
        self.assertEquals(
39
41
            ("commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba")),
40
42
            self.map.lookup_git_sha("5686645d49063c73d35436192dfc9a160c672301"))
41
43
 
42
44
    def test_lookup_notfound(self):
43
 
        self.assertRaises(KeyError, 
 
45
        self.assertRaises(KeyError,
44
46
            self.map.lookup_git_sha, "5686645d49063c73d35436192dfc9a160c672301")
45
 
        
 
47
 
46
48
    def test_blob(self):
47
49
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
 
50
        self.map.start_write_group()
48
51
        self.map.add_entry(thesha, "blob", ("myfileid", "myrevid"))
 
52
        self.map.commit_write_group()
49
53
        self.assertEquals(
50
54
            ("blob", ("myfileid", "myrevid")),
51
55
            self.map.lookup_git_sha(thesha))
53
57
 
54
58
    def test_tree(self):
55
59
        thesha = "5686645d49063c73d35436192dfc9a160c672301"
56
 
        self.map.add_entry(thesha, 
 
60
        self.map.start_write_group()
 
61
        self.map.add_entry(thesha,
57
62
            "tree", ("somepath", "myrevid"))
 
63
        self.map.commit_write_group()
58
64
        self.assertEquals(
59
65
            ("tree", ("somepath", "myrevid")),
60
66
            self.map.lookup_git_sha(thesha))
61
67
        self.assertEquals(thesha, self.map.lookup_tree("somepath", "myrevid"))
62
68
 
63
69
    def test_revids(self):
64
 
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301", 
 
70
        self.map.start_write_group()
 
71
        self.map.add_entry("5686645d49063c73d35436192dfc9a160c672301",
65
72
            "commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba"))
 
73
        self.map.commit_write_group()
66
74
        self.assertEquals(["myrevid"], list(self.map.revids()))
67
75
 
68
76