/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

Move functions to mapping.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
from bzrlib.plugins.git.foreign import (
41
41
    versionedfiles,
42
42
    )
43
 
from bzrlib.plugins.git.mapping import default_mapping, mapping_registry
 
43
from bzrlib.plugins.git.mapping import default_mapping, mapping_registry, inventory_to_tree_and_blobs, revision_to_commit
44
44
from bzrlib.plugins.git.versionedfiles import GitTexts
45
45
 
46
46
import dulwich as git
154
154
        """Impor the gist of another revision into this Git repository.
155
155
 
156
156
        """
 
157
        objects = []
157
158
        rev = source.get_revision(revid)
158
 
        inventory_to_tree_and_blobs(source, None, revid)
159
 
        commit = revision_to_commit(rev, FIXME, parent_lookup)
160
 
        pass
 
159
        for sha, object, path in inventory_to_tree_and_blobs(source, None, revid):
 
160
            if path == "":
 
161
                tree_sha = sha
 
162
            objects.append((sha, object))
 
163
        commit = revision_to_commit(rev, tree_sha, parent_lookup)
 
164
        objects.append((commit.sha(), commit))
 
165
        self._git.object_store.add_objects(len(objects), objects)
161
166
 
162
167
    def dfetch(self, source, stop_revision):
163
168
        if stop_revision is None:
174
179
            try:
175
180
                for i, revid in enumerate(reversed(todo)):
176
181
                    pb.update("pushing revisions", i, len(todo))
177
 
                    revidmap[revid] = self.import_revision_gist(source, revid)
 
182
                    revidmap[revid] = self.import_revision_gist(source, revid, revidmap.get)
178
183
            finally:
179
184
                pb.finished()
180
185
        finally: