~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-03 08:32:14 UTC
  • mfrom: (4797.2.10 2.1)
  • mto: This revision was merged to the branch mainline in revision 5000.
  • Revision ID: v.ladeuil+lp@free.fr-20100203083214-7kwhr0tajktb22bb
Merge 2.1 to trunk, including fix for bug #515597

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    This is a base class for concrete custom file merging logic. Concrete
100
100
    classes should implement ``merge_text``.
101
101
 
 
102
    See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.
 
103
    
102
104
    :ivar affected_files: The configured file paths to merge.
 
105
 
103
106
    :cvar name_prefix: The prefix to use when looking up configuration
104
 
        details.
 
107
        details. <name_prefix>_merge_files describes the files targeted by the
 
108
        hook for example.
 
109
        
105
110
    :cvar default_files: The default file paths to merge when no configuration
106
111
        is present.
107
112
    """
118
123
            raise ValueError("name_prefix must be set.")
119
124
 
120
125
    def filename_matches_config(self, params):
 
126
        """Check whether the file should call the merge hook.
 
127
 
 
128
        <name_prefix>_merge_files configuration variable is a list of files
 
129
        that should use the hook.
 
130
        """
121
131
        affected_files = self.affected_files
122
132
        if affected_files is None:
123
133
            config = self.merger.this_tree.branch.get_config()
150
160
            # option.
151
161
            not self.filename_matches_config(params)):
152
162
            return 'not_applicable', None
153
 
        return self.merge_text(self, params)
 
163
        return self.merge_text(params)
154
164
 
155
165
    def merge_text(self, params):
156
166
        """Merge the byte contents of a single file.