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

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
from ..bzr.testament import (
56
56
    StrictTestament3,
57
57
    )
 
58
from ..tree import InterTree
58
59
from ..tsort import (
59
60
    topo_sort,
60
61
    )
125
126
    # Check what revision we should store
126
127
    parent_keys = []
127
128
    for ptree in parent_bzr_trees:
 
129
        intertree = InterTree.get(ptree, base_bzr_tree)
128
130
        try:
129
 
            ppath = ptree.id2path(file_id)
130
 
        except errors.NoSuchId:
 
131
            ppath = intertree.find_source_paths(decoded_path, recurse='none')
 
132
        except errors.NoSuchFile:
 
133
            continue
 
134
        if ppath is None:
131
135
            continue
132
136
        pkind = ptree.kind(ppath)
133
137
        if (pkind == ie.kind and
182
186
    (base_mode, mode) = modes
183
187
    if base_hexsha == hexsha and base_mode == mode:
184
188
        return [], {}
 
189
    path = path.decode('utf-8')
185
190
    file_id = lookup_file_id(path)
186
191
    invdelta = []
187
192
    ie = TreeReference(file_id, name.decode("utf-8"), parent_id)
188
193
    ie.revision = revision_id
189
194
    if base_hexsha is not None:
190
 
        old_path = path.decode("utf-8")  # Renames are not supported yet
 
195
        old_path = path  # Renames are not supported yet
191
196
        if stat.S_ISDIR(base_mode):
192
197
            invdelta.extend(remove_disappeared_children(
193
198
                base_bzr_tree, old_path, lookup_object(base_hexsha), [],
378
383
 
379
384
 
380
385
def import_git_commit(repo, mapping, head, lookup_object,
381
 
                      target_git_object_retriever, trees_cache):
 
386
                      target_git_object_retriever, trees_cache, strict):
382
387
    o = lookup_object(head)
383
388
    # Note that this uses mapping.revision_id_foreign_to_bzr. If the parents
384
389
    # were bzr roundtripped revisions they would be specified in the
385
390
    # roundtrip data.
386
391
    rev, roundtrip_revid, verifiers = mapping.import_commit(
387
 
        o, mapping.revision_id_foreign_to_bzr)
 
392
        o, mapping.revision_id_foreign_to_bzr, strict)
388
393
    if roundtrip_revid is not None:
389
394
        original_revid = rev.revision_id
390
395
        rev.revision_id = roundtrip_revid
402
407
        base_tree = lookup_object(o.parents[0]).tree
403
408
        base_mode = stat.S_IFDIR
404
409
    store_updater = target_git_object_retriever._get_updater(rev)
405
 
    tree_supplement = mapping.get_fileid_map(lookup_object, o.tree)
406
410
    inv_delta, unusual_modes = import_git_tree(
407
411
        repo.texts, mapping, b"", b"", (base_tree, o.tree), base_bzr_tree,
408
412
        None, rev.revision_id, parent_trees, lookup_object,
409
413
        (base_mode, stat.S_IFDIR), store_updater,
410
 
        tree_supplement.lookup_file_id,
 
414
        mapping.generate_file_id,
411
415
        allow_submodules=repo._format.supports_tree_reference)
412
416
    if unusual_modes != {}:
413
417
        for path, mode in unusual_modes.iteritems():
483
487
            continue
484
488
        if isinstance(o, Commit):
485
489
            rev, roundtrip_revid, verifiers = mapping.import_commit(
486
 
                o, mapping.revision_id_foreign_to_bzr)
 
490
                o, mapping.revision_id_foreign_to_bzr, strict=True)
487
491
            if (repo.has_revision(rev.revision_id)
488
492
                    or (roundtrip_revid and
489
493
                        repo.has_revision(roundtrip_revid))):
516
520
                        pb.update("fetching revisions", offset + i,
517
521
                                  len(revision_ids))
518
522
                    import_git_commit(repo, mapping, head, lookup_object,
519
 
                                      target_git_object_retriever, trees_cache)
 
523
                                      target_git_object_retriever, trees_cache,
 
524
                                      strict=True)
520
525
                    last_imported = head
521
526
            except BaseException:
522
527
                repo.abort_write_group()