~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-03 09:04:38 UTC
  • mfrom: (4999.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100203090438-2qn9wus9kyyfyyek
(vila) Merge 2.1 to trunk,
        including fix for bug #515597 (per-file merge hook typo)

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.