~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

Merge pt1 hooks branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    errors,
83
83
    lockdir,
84
84
    mail_client,
 
85
    mergetools,
85
86
    osutils,
86
87
    registry,
87
88
    symbol_versioning,
357
358
        else:
358
359
            return True
359
360
 
 
361
    def get_merge_tools(self):
 
362
        tools = {}
 
363
        for (oname, value, section, conf_id, parser) in self._get_options():
 
364
            if oname.startswith('bzr.mergetool.'):
 
365
                tool_name = oname[len('bzr.mergetool.'):]
 
366
                tools[tool_name] = value
 
367
        trace.mutter('loaded merge tools: %r' % tools)
 
368
        return tools
 
369
 
 
370
    def find_merge_tool(self, name):
 
371
        # We fake a defaults mechanism here by checking if the given name can 
 
372
        # be found in the known_merge_tools if it's not found in the config.
 
373
        # This should be done through the proposed config defaults mechanism
 
374
        # when it becomes available in the future.
 
375
        command_line = (self.get_user_option('bzr.mergetool.%s' % name) or
 
376
                        mergetools.known_merge_tools.get(name, None))
 
377
        return command_line
 
378
 
360
379
 
361
380
class IniBasedConfig(Config):
362
381
    """A configuration policy that draws from ini files."""