/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 versionedfiles.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:
19
19
    )
20
20
from bzrlib.versionedfile import (
21
21
    AbsentContentFactory,
 
22
    FulltextContentFactory,
22
23
    VersionedFiles,
23
24
    )
24
25
 
 
26
from bzrlib.plugins.git.converter import (
 
27
    GitObjectConverter,
 
28
    )
 
29
 
25
30
class GitTexts(VersionedFiles):
26
31
 
27
32
    def __init__(self, repository):
28
33
        self.repository = repository
 
34
        
29
35
 
30
36
    def check(self, progressbar=None):
31
37
        return True
35
41
 
36
42
    def get_record_stream(self, keys, ordering, include_delta_closure):
37
43
        for key in keys:
38
 
            yield AbsentContentFactory(key)
 
44
            (fileid, revid) = key
 
45
            (foreign_revid, mapping) = self.repository.revision_id_bzr_to_foreign(revid)
 
46
            idmap = GitObjectConverter(self.repository, mapping)._idmap
 
47
            path = mapping.parse_file_id(fileid)
 
48
            try:
 
49
                sha = idmap.lookup_tree(path, revid)
 
50
            except KeyError:
 
51
                try:
 
52
                    sha = idmap.lookup_blob(fileid, revid)
 
53
                except KeyError:
 
54
                    yield AbsentContentFactory(key)
 
55
                else:
 
56
                    blob = self.repository.object_store[sha]
 
57
                    yield FulltextContentFactory(key, None, None, "")
 
58
            else:
 
59
                yield FulltextContentFactory(key, None, None, blob)
39
60
 
40
61
    def get_parent_map(self, keys):
41
62
        raise NotImplementedError(self.get_parent_map)
42
63
 
43
 
 
44