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

Merge new bzr-foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
            raise AssertionError("Unknown blob kind, perms=%r." % (mode,))
123
123
 
124
124
 
125
 
def import_git_objects(repo, mapping, num_objects, object_iter, pb=None):
 
125
def import_git_objects(repo, mapping, object_iter, pb=None):
126
126
    """Import a set of git objects into a bzr repository.
127
127
 
128
128
    :param repo: Bazaar repository
129
129
    :param mapping: Mapping to use
130
 
    :param num_objects: Number of objects.
131
130
    :param object_iter: Iterator over Git objects.
132
131
    """
133
132
    # TODO: a more (memory-)efficient implementation of this
134
133
    objects = {}
135
134
    for i, o in enumerate(object_iter):
136
135
        if pb is not None:
137
 
            pb.update("fetching objects", i, num_objects) 
 
136
            pb.update("fetching objects", i) 
138
137
        objects[o.id] = o
139
138
    graph = []
140
139
    root_trees = {}
204
203
        if mapping is None:
205
204
            mapping = self.source.get_mapping()
206
205
        def progress(text):
207
 
            pb.update("git: %s" % text.rstrip("\r\n"), 0, 0)
 
206
            pb.note("git: %s", text)
208
207
        def determine_wants(heads):
209
208
            if revision_id is None:
210
209
                ret = heads.values()
220
219
            try:
221
220
                self.target.start_write_group()
222
221
                try:
223
 
                    (num_objects, objects_iter) = \
224
 
                            self.source.fetch_objects(determine_wants, 
225
 
                                graph_walker, progress)
226
 
                    import_git_objects(self.target, mapping, num_objects, 
227
 
                                       objects_iter, pb)
 
222
                    import_git_objects(self.target, mapping,
 
223
                        iter(self.source.fetch_objects(determine_wants, graph_walker, 
 
224
                            progress)), pb)
228
225
                finally:
229
226
                    self.target.commit_write_group()
230
227
            finally: