/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/committemplate.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 20:13:37 UTC
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723201337-tnai5u6slql8do96
Improve documentation a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
class CommitTemplate(object):
28
28
 
29
 
    def __init__(self, commit, message, filespec):
 
29
    def __init__(self, commit, message, file_matches):
30
30
        """Create a commit template for commit with initial message message.
31
31
 
32
32
        :param commit: A Commit object for the in progress commit.
33
33
        :param message: The current message (which may be None).
34
 
        :param filespec: File specification list
 
34
        :param file_matches: Check whether file matches
35
35
        """
36
36
        self.commit = commit
37
37
        self.message = message
38
 
        self.filespec = filespec
 
38
        self.file_matches = file_matches
39
39
 
40
40
    def make(self):
41
41
        """Make the template.
48
48
        found_old_path = None
49
49
        found_entry = None
50
50
        for old_path, new_path, fileid, entry in delta:
51
 
            if new_path in self.filespec:
 
51
            if self.file_matches(new_path):
52
52
                found_entry = entry
53
53
                found_old_path = old_path
54
54
                break