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

Merge thin-pack work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2007 Canonical Ltd
2
 
# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
3
2
#
4
3
# This program is free software; you can redistribute it and/or modify
5
4
# it under the terms of the GNU General Public License as published by
17
16
 
18
17
"""An adapter between a Git Repository and a Bazaar Branch"""
19
18
 
20
 
import dulwich as git
21
19
import os
22
20
import time
23
21
 
42
40
from bzrlib.plugins.git.foreign import (
43
41
    versionedfiles,
44
42
    )
45
 
from bzrlib.plugins.git.mapping import (
46
 
    default_mapping,
47
 
    inventory_to_tree_and_blobs,
48
 
    mapping_registry,
49
 
    revision_to_commit,
50
 
    )
 
43
from bzrlib.plugins.git.mapping import default_mapping, mapping_registry, inventory_to_tree_and_blobs, revision_to_commit
51
44
from bzrlib.plugins.git.versionedfiles import GitTexts
52
45
 
 
46
import dulwich as git
 
47
 
53
48
 
54
49
class GitTags(object):
55
50
 
106
101
 
107
102
    def all_revision_ids(self):
108
103
        ret = set([revision.NULL_REVISION])
109
 
        heads = self._git.heads()
110
 
        if heads == {}:
 
104
        if self._git.heads() == []:
111
105
            return ret
112
 
        bzr_heads = [self.get_mapping().revision_id_foreign_to_bzr(h) for h in heads.itervalues()]
 
106
        bzr_heads = [self.get_mapping().revision_id_foreign_to_bzr(h) for h in self._git.heads()]
113
107
        ret = set(bzr_heads)
114
108
        graph = self.get_graph()
115
109
        for rev, parents in graph.iter_ancestry(bzr_heads):
145
139
        """See Repository.get_ancestry().
146
140
        """
147
141
        if revision_id is None:
148
 
            return [None, revision.NULL_REVISION] + self._all_revision_ids()
 
142
            return self._all_revision_ids()
149
143
        assert isinstance(revision_id, str)
150
144
        ancestry = []
151
145
        graph = self.get_graph()
152
146
        for rev, parents in graph.iter_ancestry([revision_id]):
 
147
            if rev == revision.NULL_REVISION:
 
148
                rev = None
153
149
            ancestry.append(rev)
154
150
        ancestry.reverse()
155
 
        return [None] + ancestry
 
151
        return ancestry
156
152
 
157
153
    def import_revision_gist(self, source, revid, parent_lookup):
158
 
        """Import the gist of a revision into this Git repository.
 
154
        """Impor the gist of another revision into this Git repository.
159
155
 
160
156
        """
161
157
        objects = []
170
166
        return commit.sha().hexdigest()
171
167
 
172
168
    def dfetch(self, source, stop_revision):
173
 
        """Import the gist of the ancestry of a particular revision."""
174
169
        if stop_revision is None:
175
170
            raise NotImplementedError
176
171
        revidmap = {}