/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

  • Committer: Jelmer Vernooij
  • Date: 2010-05-02 22:14:04 UTC
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100502221404-2zt3qgnwk2is7xa9
Reformatting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
            pie = pinv[file_id]
133
133
        except NoSuchId:
134
134
            continue
135
 
        if pie.text_sha1 == ie.text_sha1 and pie.executable == ie.executable and pie.symlink_target == ie.symlink_target:
 
135
        if (pie.text_sha1 == ie.text_sha1 and
 
136
            pie.executable == ie.executable and
 
137
            pie.symlink_target == ie.symlink_target):
136
138
            # found a revision in one of the parents to use
137
139
            ie.revision = pie.revision
138
140
            break
147
149
            chunks = []
148
150
        else: 
149
151
            chunks = blob.chunked
150
 
        texts.insert_record_stream([ChunkedContentFactory((file_id, ie.revision), tuple(parent_keys), ie.text_sha1, chunks)])
 
152
        texts.insert_record_stream([
 
153
            ChunkedContentFactory((file_id, ie.revision),
 
154
                tuple(parent_keys), ie.text_sha1, chunks)])
151
155
    invdelta = []
152
156
    if base_hexsha is not None:
153
157
        old_path = path # Renames are not supported yet
180
184
    else:
181
185
        oldpath = path
182
186
    ie.reference_revision = mapping.revision_id_foreign_to_bzr(hexsha)
183
 
    texts.insert_record_stream([ChunkedContentFactory((file_id, ie.revision), (), None, [])])
 
187
    texts.insert_record_stream([
 
188
        ChunkedContentFactory((file_id, ie.revision), (), None, [])])
184
189
    invdelta = [(oldpath, path, file_id, ie)]
185
190
    return invdelta, {}
186
191
 
246
251
            child_base_hexsha = None
247
252
            child_base_mode = 0
248
253
        if stat.S_ISDIR(child_mode):
249
 
            subinvdelta, grandchildmodes = import_git_tree(
250
 
                    texts, mapping, child_path, name,
251
 
                    (child_base_hexsha, child_hexsha),
252
 
                    base_inv, file_id, revision_id, parent_invs, lookup_object,
253
 
                    (child_base_mode, child_mode), store_updater, 
254
 
                    lookup_file_id, allow_submodules=allow_submodules)
 
254
            subinvdelta, grandchildmodes = import_git_tree(texts, mapping,
 
255
                child_path, name, (child_base_hexsha, child_hexsha), base_inv,
 
256
                file_id, revision_id, parent_invs, lookup_object, 
 
257
                (child_base_mode, child_mode), store_updater, lookup_file_id,
 
258
                allow_submodules=allow_submodules)
255
259
        elif S_ISGITLINK(child_mode): # submodule
256
260
            if not allow_submodules:
257
261
                raise SubmodulesRequireSubtrees()
258
 
            subinvdelta, grandchildmodes = import_git_submodule(
259
 
                    texts, mapping, child_path, name,
260
 
                    (child_base_hexsha, child_hexsha),
261
 
                    base_inv, file_id, revision_id, parent_invs, lookup_object,
262
 
                    (child_base_mode, child_mode), store_updater,
263
 
                    lookup_file_id)
 
262
            subinvdelta, grandchildmodes = import_git_submodule(texts, mapping,
 
263
                child_path, name, (child_base_hexsha, child_hexsha), base_inv,
 
264
                file_id, revision_id, parent_invs, lookup_object,
 
265
                (child_base_mode, child_mode), store_updater, lookup_file_id)
264
266
        else:
265
 
            subinvdelta = import_git_blob(texts, mapping,
266
 
                    child_path, name, (child_base_hexsha, child_hexsha),
267
 
                    base_inv, file_id, revision_id, parent_invs, lookup_object,
268
 
                    (child_base_mode, child_mode), store_updater,
269
 
                    lookup_file_id)
 
267
            subinvdelta = import_git_blob(texts, mapping, child_path, name,
 
268
                (child_base_hexsha, child_hexsha), base_inv, file_id,
 
269
                revision_id, parent_invs, lookup_object,
 
270
                (child_base_mode, child_mode), store_updater, lookup_file_id)
270
271
            grandchildmodes = {}
271
272
        child_modes.update(grandchildmodes)
272
273
        invdelta.extend(subinvdelta)
306
307
               sorted(old_obj) == sorted(new_obj)):
307
308
            for name in old_obj:
308
309
                if old_obj[name][0] != new_obj[name][0]:
309
 
                    raise AssertionError("Modes for %s differ: %o != %o" % (path, old_obj[name][0], new_obj[name][0]))
 
310
                    raise AssertionError("Modes for %s differ: %o != %o" %
 
311
                        (path, old_obj[name][0], new_obj[name][0]))
310
312
                if old_obj[name][1] != new_obj[name][1]:
311
313
                    # Found a differing child, delve deeper
312
314
                    path = posixpath.join(path, name)
436
438
                        pb.update("fetching revisions", offset+i,
437
439
                                  len(revision_ids))
438
440
                    import_git_commit(repo, mapping, head, lookup_object,
439
 
                                      target_git_object_retriever,
440
 
                                      trees_cache)
 
441
                        target_git_object_retriever, trees_cache)
441
442
                    last_imported = head
442
443
            except:
443
444
                repo.abort_write_group()
501
502
            present_interesting_heads = self.target.has_revisions(interesting_heads)
502
503
            missing_interesting_heads = set(interesting_heads) - present_interesting_heads
503
504
            if missing_interesting_heads:
504
 
                raise AssertionError("Missing interesting heads: %r" % missing_interesting_heads)
 
505
                raise AssertionError("Missing interesting heads: %r" %
 
506
                    missing_interesting_heads)
505
507
        return self._refs
506
508
 
507
509
 
548
550
            if pb is None:
549
551
                create_pb = pb = ui.ui_factory.nested_progress_bar()
550
552
            try:
551
 
                objects_iter = self.source.fetch_objects(
552
 
                            record_determine_wants, graph_walker,
553
 
                            store.get_raw, progress)
 
553
                objects_iter = self.source.fetch_objects(record_determine_wants,
 
554
                    graph_walker, store.get_raw, progress)
554
555
                return import_git_objects(self.target, mapping,
555
556
                    objects_iter, store, recorded_wants, pb, limit)
556
557
            finally: