~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2007-07-06 17:21:34 UTC
  • mto: (2590.2.12 changes-merge)
  • mto: This revision was merged to the branch mainline in revision 2603.
  • Revision ID: abentley@panoramicfeedback.com-20070706172134-kz3k30d2pu61qngi
Restore conflict handling changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
from bzrlib.textfile import check_text_lines
46
46
from bzrlib.trace import mutter, warning, note
47
47
from bzrlib.transform import (TreeTransform, resolve_conflicts, cook_conflicts,
48
 
                              FinalPaths, create_by_entry, unique_add,
49
 
                              ROOT_PARENT)
 
48
                              conflict_pass, FinalPaths, create_by_entry,
 
49
                              unique_add, ROOT_PARENT)
50
50
from bzrlib.versionedfile import WeaveMerge
51
51
from bzrlib import ui
52
52
 
471
471
            self.pp.next_phase()
472
472
            child_pb = ui.ui_factory.nested_progress_bar()
473
473
            try:
474
 
                fs_conflicts = resolve_conflicts(self.tt, child_pb)
 
474
                fs_conflicts = resolve_conflicts(self.tt, child_pb,
 
475
                    lambda t, c: conflict_pass(t, c, self.other_tree))
475
476
            finally:
476
477
                child_pb.finished()
477
478
            if change_reporter is not None:
604
605
        return tree.kind(file_id)
605
606
 
606
607
    @staticmethod
 
608
    def _three_way(base, other, this):
 
609
        #if base == other, either they all agree, or only THIS has changed.
 
610
        if base == other:
 
611
            return 'this'
 
612
        if this not in (base, other):
 
613
            return 'conflict'
 
614
        # "Ambiguous clean merge"
 
615
        elif this == other:
 
616
            return "this"
 
617
        else:
 
618
            assert this == base
 
619
            return "other"
 
620
 
 
621
    @staticmethod
607
622
    def scalar_three_way(this_tree, base_tree, other_tree, file_id, key):
608
623
        """Do a three-way test on a scalar.
609
624
        Return "this", "other" or "conflict", depending whether a value wins.
644
659
                parents.append(entry.parent_id)
645
660
        return self._merge_names(file_id, parents, names)
646
661
 
647
 
    @staticmethod
648
 
    def _three_way(base, other, this):
649
 
        if base == other:
650
 
            return 'this'
651
 
        if this not in (base, other):
652
 
            return 'conflict'
653
 
        elif this == other:
654
 
            return "this"
655
 
        else:
656
 
            assert this == base
657
 
            return "other"
658
 
 
659
662
    def _merge_names(self, file_id, parents, names):
660
663
        """Perform a merge on file_id names and parents"""
661
664
        base_name, other_name, this_name = names