/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 breezy/plugins/commitfromnews/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 19:18:44 UTC
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723191844-5me3az7xe3rnbheg
The 'commitfromnews' plugin is now bundled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from __future__ import absolute_import
35
35
 
36
36
from ... import hooks
 
37
from ...config import (
 
38
    option_registry,
 
39
    ListOption,
 
40
    )
 
41
 
 
42
option_registry.register(
 
43
    ListOption('commit.templatefromfiles'))
37
44
 
38
45
 
39
46
def commit_template(commit, message):
40
47
    """Create a commit message for commit based on changes in the tree."""
41
 
    from .committemplate import CommitTemplate
42
 
    template = CommitTemplate(commit, message)
43
 
    return template.make()
 
48
    config_stack = commit.work_tree.get_config_stack()
 
49
    filespec = config_stack.get('commit.templatefromfiles')
 
50
    if filespec:
 
51
        from .committemplate import CommitTemplate
 
52
        template = CommitTemplate(commit, message, filespec)
 
53
        return template.make()
 
54
    return message
44
55
 
45
56
 
46
57
def load_tests(loader, basic_tests, pattern):