Bastian Blank <>


r848628 | brane | 2004-02-03 15:17:06 -0600 (Tue, 03 Feb 2004)

Closing issue #1727.

Teach to generate propchange messages. This change
introduces subcommands to the 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: commit     REPOS-DIR REVISION [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 <>

[in tools/hook-scripts/mailer]
* mailer.conf.example: Rename 'subject_prefix' to 'commit_subject_prefix'.
  Add parameter 'propchange_subject_prefix'.

  (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().
  ( Renamed from run_diff().

  (StandardOutput.__init__, StandardOutput.start, StandardOutput.finish, Adjust names and signatures to match MailedOutput.

  (PipeOutput.__init__, PipeOutput.start, 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.