/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

Remove bzr-foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    )
20
20
from dulwich.objects import (
21
21
    Blob,
 
22
    Commit,
22
23
    Tree,
23
24
    )
24
25
 
32
33
    )
33
34
 
34
35
 
 
36
class GitRevisions(VersionedFiles):
 
37
 
 
38
    def __init__(self, object_store):
 
39
        self.object_store = object_store
 
40
 
 
41
    def check(self, progressbar=None):
 
42
        return True
 
43
 
 
44
    def iterkeys(self):
 
45
        for sha in self.object_store:
 
46
            if type(sha) == Commit:
 
47
                yield (sha,)
 
48
 
 
49
    def keys(self):
 
50
        return list(self.iterkeys())
 
51
 
 
52
    def add_mpdiffs(self, records):
 
53
        raise NotImplementedError(self.add_mpdiffs)
 
54
 
 
55
    def get_record_stream(self, keys, ordering, include_delta_closure):
 
56
        for key in keys:
 
57
            (sha,) = key
 
58
            try:
 
59
                text = self.object_store.get_raw(sha)
 
60
            except KeyError:
 
61
                yield AbsentContentFactory(key)
 
62
            else:
 
63
                yield FulltextContentFactory(key, None, None, text)
 
64
 
 
65
    def get_parent_map(self, keys):
 
66
        ret = {}
 
67
        for (key,) in keys:
 
68
            try:
 
69
                ret[(key,)] = [(p,) for p in self.object_store[key].parents]
 
70
            except KeyError:
 
71
                ret[(key,)] = None
 
72
        return ret
 
73
 
 
74
 
35
75
class GitTexts(VersionedFiles):
36
76
    """A texts VersionedFiles instance that is backed onto a Git object store."""
37
77