~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 01:31:11 UTC
  • mto: (2590.2.12 changes-merge)
  • mto: This revision was merged to the branch mainline in revision 2603.
  • Revision ID: aaron.bentley@utoronto.ca-20070706013111-gykms7zh122pm0z8
Misc cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
            self.this_rev_id = self.this_basis
170
170
 
171
171
    def set_interesting_files(self, file_list):
172
 
        try:
173
 
            self.interesting_files = file_list
174
 
        except NotVersionedError, e:
175
 
            raise BzrCommandError("%s is not a source file in any"
176
 
                                      " tree." % e.path)
 
172
        self.interesting_files = file_list
177
173
 
178
174
    def _set_interesting_files(self, file_list):
179
175
        """Set the list of interesting ids from a list of files."""
425
421
    supports_reprocess = True
426
422
    supports_show_base = True
427
423
    history_based = False
 
424
    winner_idx = {"this": 2, "other": 1, "conflict": 1}
428
425
 
429
426
    def __init__(self, working_tree, this_tree, base_tree, other_tree, 
430
427
                 interesting_ids=None, reprocess=False, show_base=False,
498
495
            self.pb.clear()
499
496
 
500
497
    def _entries3(self):
 
498
        """Gather data about files modified between three trees.
 
499
 
 
500
        Return a list of tuples of file_id, changed, parents3, names3,
 
501
        executable3.  changed is a boolean indicating whether the file contents
 
502
        or kind were changed.  parents3 is a tuple of parent ids for base,
 
503
        other and this.  names3 is a tuple of names for base, other and this.
 
504
        executable3 is a tuple of execute-bit values for base, other and this.
 
505
        """
501
506
        result = []
502
507
        iterator = self.other_tree._iter_changes(self.base_tree,
503
508
                include_unchanged=True, specific_files=self.interesting_files,
619
624
            return "other"
620
625
 
621
626
    def merge_names(self, file_id):
622
 
        """Perform a merge on file_id names and parents"""
623
627
        def get_entry(tree):
624
628
            if file_id in tree.inventory:
625
629
                return tree.inventory[file_id]
652
656
            assert this == base
653
657
            return "other"
654
658
 
655
 
 
656
659
    def _merge_names(self, file_id, parents, names):
 
660
        """Perform a merge on file_id names and parents"""
657
661
        base_name, other_name, this_name = names
658
662
        base_parent, other_parent, this_parent = parents
659
663
 
680
684
            # 'conflict'-- if there's no 'other', we leave it alone.
681
685
            return
682
686
        # if we get here, name_winner and parent_winner are set to safe values.
683
 
        winner_idx = {"this": 2, "other": 1, "conflict": 1}
684
687
        trans_id = self.tt.trans_id_file_id(file_id)
685
 
        parent_id = parents[winner_idx[parent_id_winner]]
 
688
        parent_id = parents[self.winner_idx[parent_id_winner]]
686
689
        if parent_id is not None:
687
690
            parent_trans_id = self.tt.trans_id_file_id(parent_id)
688
 
            self.tt.adjust_path(names[winner_idx[name_winner]],
 
691
            self.tt.adjust_path(names[self.winner_idx[name_winner]],
689
692
                                parent_trans_id, trans_id)
690
693
 
691
694
    def merge_contents(self, file_id):