/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

Add some basic documentation in 'bzr help git'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
from bzrlib.revisiontree import (
57
57
    RevisionTree,
58
58
    )
59
 
from bzrlib.testament import (
60
 
    StrictTestament3,
61
 
    )
62
59
from bzrlib.tsort import (
63
60
    topo_sort,
64
61
    )
344
341
def import_git_commit(repo, mapping, head, lookup_object,
345
342
                      target_git_object_retriever, trees_cache):
346
343
    o = lookup_object(head)
347
 
    rev, roundtrip_revid, verifiers = mapping.import_commit(o,
 
344
    rev = mapping.import_commit(o,
348
345
            lambda x: target_git_object_retriever.lookup_git_sha(x)[1][0])
349
346
    # We have to do this here, since we have to walk the tree and
350
347
    # we need to make sure to import the blobs / trees with the right
359
356
        base_tree = lookup_object(o.parents[0]).tree
360
357
        base_mode = stat.S_IFDIR
361
358
    store_updater = target_git_object_retriever._get_updater(rev)
 
359
    store_updater.add_object(o, None, None)
362
360
    fileid_map = mapping.get_fileid_map(lookup_object, o.tree)
363
361
    inv_delta, unusual_modes = import_git_tree(repo.texts,
364
362
            mapping, "", "", (base_tree, o.tree), base_inv,
366
364
            lookup_object, (base_mode, stat.S_IFDIR), store_updater,
367
365
            fileid_map.lookup_file_id,
368
366
            allow_submodules=getattr(repo._format, "supports_tree_reference", False))
 
367
    store_updater.finish()
369
368
    if unusual_modes != {}:
370
369
        for path, mode in unusual_modes.iteritems():
371
370
            warn_unusual_mode(rev.foreign_revid, path, mode)
377
376
        base_inv = None
378
377
    rev.inventory_sha1, inv = repo.add_inventory_by_delta(basis_id,
379
378
              inv_delta, rev.revision_id, rev.parent_ids, base_inv)
380
 
    # FIXME: Check verifiers
381
 
    testament = StrictTestament3(rev, inv)
382
 
    calculated_verifiers = { "testament3-sha1": testament.as_sha1() }
383
 
    if roundtrip_revid is not None:
384
 
        original_revid = rev.revision_id
385
 
        rev.revision_id = roundtrip_revid
386
 
        if calculated_verifiers != verifiers:
387
 
            trace.mutter("Testament SHA1 %r for %r did not match %r.",
388
 
                         calculated_verifiers["testament3-sha1"],
389
 
                         rev.revision_id, verifiers["testament3-sha1"])
390
 
            rev.revision_id = original_revid
391
 
    store_updater.add_object(o, calculated_verifiers, None)
392
 
    store_updater.finish()
393
379
    ret_tree = RevisionTree(repo, inv, rev.revision_id)
394
380
    trees_cache.add(ret_tree)
395
381
    repo.add_revision(rev.revision_id, rev)
428
414
        except KeyError:
429
415
            continue
430
416
        if isinstance(o, Commit):
431
 
            rev, roundtrip_revid, verifiers = mapping.import_commit(o,
432
 
                lambda x: None)
433
 
            if (repo.has_revision(rev.revision_id) or
434
 
                (roundtrip_revid and repo.has_revision(roundtrip_revid))):
 
417
            rev = mapping.import_commit(o, lambda x: None)
 
418
            if repo.has_revision(rev.revision_id):
435
419
                continue
436
420
            graph.append((o.id, o.parents))
437
421
            heads.extend([p for p in o.parents if p not in checked])