/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 bzrlib/merge.py

  • Committer: Andrew Bennetts
  • Date: 2010-04-22 07:35:06 UTC
  • mto: This revision was merged to the branch mainline in revision 5193.
  • Revision ID: andrew.bennetts@canonical.com-20100422073506-7i5pqyhzdj5pcelx
Create a PerFileMerger helper class that is midway between AbstractPerFileMerger and ConfigurableFileMerger.  It allows the example merge plugin in the docs (the always conflict *.xml files) to be much, much simpler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
        """Lookup the filename (i.e. basename, not path), given a Tree (e.g.
114
114
        self.merger.this_tree) and a MergeHookParams.
115
115
        """
116
 
        return osutils.basename(tree.id2path(params.file_id))
 
116
        return tree.inventory[params.file_id].name
117
117
 
118
118
    def get_filepath(self, params, tree):
119
119
        """Calculate the path to the file in a tree.
134
134
            # The filename doesn't match *.xml
135
135
            not self.file_matches(params)):
136
136
            return 'not_applicable', None
137
 
        return self.merge_matching(params)
 
137
        return self.merge_matching(self, params)
138
138
 
139
139
    def merge_matching(self, params):
140
140
        """Merge the contents of a single file that has matched the criteria
745
745
        :param this_tree: The local tree in the merge operation
746
746
        :param base_tree: The common tree in the merge operation
747
747
        :param other_tree: The other tree to merge changes from
748
 
        :param this_branch: The branch associated with this_tree.  Defaults to
749
 
            this_tree.branch if not supplied.
 
748
        :param this_branch: The branch associated with this_tree
750
749
        :param interesting_ids: The file_ids of files that should be
751
750
            participate in the merge.  May not be combined with
752
751
            interesting_files.
770
769
        if interesting_files is not None and interesting_ids is not None:
771
770
            raise ValueError(
772
771
                'specify either interesting_ids or interesting_files')
773
 
        if this_branch is None:
774
 
            this_branch = this_tree.branch
775
772
        self.interesting_ids = interesting_ids
776
773
        self.interesting_files = interesting_files
777
774
        self.this_tree = working_tree