r848628 | brane | 2004-02-03 21:17:06 +0000 (Tue, 03 Feb 2004)
Closing issue #1727.
Teach mailer.py to generate propchange messages. This change
introduces subcommands to the mailer.py command-line, twists the
implementation into a slightly more object-oriented shape, and makes a
small change to the configuration file format.
The new invocation chant is:
mailer.py commit REPOS-DIR REVISION [CONFIG-FILE]
or
mailer.py propchange REPOS-DIR REVISION AUTHOR PROPNAME [CONFIG-FILE]
The mailer.conf parameter 'subject_prefix' is replaced by two new
parameters, 'commit_subject_prefix' and 'propchange_subject_prefix',
used by the 'commit' and 'propchange' subcommands, respectively.
Patch by: Bastian Blank <bblank@thinkmo.de>
me
[in tools/hook-scripts/mailer]
* mailer.conf.example: Rename 'subject_prefix' to 'commit_subject_prefix'.
Add parameter 'propchange_subject_prefix'.
* mailer.py
(Messenger): New. Base class for message generators.
(Messenger.determine_output): Converted to a method from determine_output().
(Commit): New. A Messenger implementation for commit messages.
(PropChange): New. A Messenger implementation for propchange messages.
(MailedOutput.__init__): Remove argument 'changelist', add 'prefix_param'.
Move the directory walking logic into Commit.__init__().
(MailedOutput.start): Add an optional override for the author name.
(MailedOutput.generate): Remove; move logic to Commit.generate().
(MailedOutput.mail_headers): Use 'prefix_param' to find the subject
prefix parameter.
(SMTPOutput.__init__): Remove.
(SMTPOutput.start): Change signature to match MailedOutput.start().
(SMTPOutput.run): Renamed from run_diff().
(StandardOutput.__init__, StandardOutput.start, StandardOutput.finish,
StandardOutput.run): Adjust names and signatures to match MailedOutput.
(PipeOutput.__init__, PipeOutput.start, PipeOutput.run): Adjust names
and signatures to match MailedOutput.
(main): Add parameters 'cmd', 'author', 'propname'. Move the group
gathering logic to Commit.__init__(), since it's specific to that
messenger. Create the messenger instance based on the subcommand.
(UnknownSubcommand): New exception class.
(__main__): Interpret the subcommands and parse the command line
according to the changed syntax.