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

  • Committer: Jelmer Vernooij
  • Date: 2020-09-02 16:35:18 UTC
  • mto: (7490.40.109 work)
  • mto: This revision was merged to the branch mainline in revision 7526.
  • Revision ID: jelmer@jelmer.uk-20200902163518-sy9f4unbboljphgu
Handle duplicate directories entries for git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
674
674
    return False
675
675
 
676
676
 
677
 
def resolve_checkout(tt, conflicts, divert):
678
 
    new_conflicts = set()
679
 
    for c_type, conflict in ((c[0], c) for c in conflicts):
680
 
        # Anything but a 'duplicate' would indicate programmer error
681
 
        if c_type != 'duplicate':
682
 
            raise AssertionError(c_type)
683
 
        # Now figure out which is new and which is old
684
 
        if tt.new_contents(conflict[1]):
685
 
            new_file = conflict[1]
686
 
            old_file = conflict[2]
687
 
        else:
688
 
            new_file = conflict[2]
689
 
            old_file = conflict[1]
690
 
 
691
 
        # We should only get here if the conflict wasn't completely
692
 
        # resolved
693
 
        final_parent = tt.final_parent(old_file)
694
 
        if new_file in divert:
695
 
            new_name = tt.final_name(old_file) + '.diverted'
696
 
            tt.adjust_path(new_name, final_parent, new_file)
697
 
            new_conflicts.add((c_type, 'Diverted to',
698
 
                               new_file, old_file))
699
 
        else:
700
 
            new_name = tt.final_name(old_file) + '.moved'
701
 
            tt.adjust_path(new_name, final_parent, old_file)
702
 
            new_conflicts.add((c_type, 'Moved existing file to',
703
 
                               old_file, new_file))
704
 
    return new_conflicts
705
 
 
706
 
 
707
677
def new_by_entry(path, tt, entry, parent_id, tree):
708
678
    """Create a new file according to its inventory entry"""
709
679
    name = entry.name
830
800
        target_executable, wt_executable = change.executable
831
801
        if skip_root and wt_path == '':
832
802
            continue
833
 
        trans_id = tt.trans_id_file_id(change.file_id)
834
803
        mode_id = None
 
804
        if wt_path is not None:
 
805
            trans_id = tt.trans_id_tree_path(wt_path)
 
806
        else:
 
807
            trans_id = tt.assign_id()
835
808
        if change.changed_content:
836
809
            keep_content = False
837
810
            if wt_kind == 'file' and (backups or target_kind is None):
963
936
        existing_file, new_file = trans_id, last_trans_id
964
937
    else:
965
938
        existing_file, new_file = last_trans_id, trans_id
966
 
    new_name = tt.final_name(existing_file) + '.moved'
967
 
    tt.adjust_path(new_name, final_parent, existing_file)
968
 
    yield (c_type, 'Moved existing file to', existing_file, new_file)
 
939
    if (not tt._tree.has_versioned_directories() and
 
940
            tt.final_kind(trans_id) == 'directory' and
 
941
            tt.final_kind(last_trans_id) == 'directory'):
 
942
        _reparent_transform_children(tt, existing_file, new_file)
 
943
        tt.delete_contents(existing_file)
 
944
        tt.unversion_file(existing_file)
 
945
        tt.cancel_creation(existing_file)
 
946
    else:
 
947
        new_name = tt.final_name(existing_file) + '.moved'
 
948
        tt.adjust_path(new_name, final_parent, existing_file)
 
949
        yield (c_type, 'Moved existing file to', existing_file, new_file)
969
950
 
970
951
 
971
952
def resolve_parent_loop(tt, path_tree, c_type, cur):