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

  • Committer: Jelmer Vernooij
  • Date: 2009-03-27 13:04:03 UTC
  • mto: (0.200.305 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090327130403-6imiy7o0amdmx6yn
Fix versionedfiles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        """Lookup the SHA of a git tree."""
60
60
        raise NotImplementedError(self.lookup_tree)
61
61
 
 
62
    def lookup_blob(self, fileid, revid):
 
63
        raise NotImplementedError(self.lookup_blob)
 
64
 
62
65
    def lookup_git_sha(self, sha):
63
66
        """Lookup a Git sha in the database.
64
67
 
93
96
                return k
94
97
        raise KeyError((path, revid))
95
98
 
 
99
    def lookup_blob(self, fileid, revid):
 
100
        for k, v in self.dict.iteritems():
 
101
            if v == ("blob", (fileid, revid)):
 
102
                return k
 
103
        raise KeyError((fileid, revid))
 
104
 
96
105
    def revids(self):
97
106
        for key, (type, type_data) in self.dict.iteritems():
98
107
            if type == "commit":
146
155
            raise KeyError((path, revid))
147
156
        return row[0]
148
157
 
 
158
    def lookup_blob(self, fileid, revid):
 
159
        row = self.db.execute("select sha1 from trees where fileid = ? and revid = ?", (fileid, revid)).fetchone()
 
160
        if row is None:
 
161
            raise KeyError((fileid, revid))
 
162
        return row[0]
 
163
 
149
164
    def lookup_git_sha(self, sha):
150
165
        """Lookup a Git sha in the database.
151
166