[merge] Re: bzr-email: add optional hostname on subject
Martin Pool
mbp at canonical.com
Tue Dec 16 02:47:45 GMT 2008
On 14 Dec 2008, Frédéric Brin <frederic.brin at assonetworx.com> wrote:
> Hy,
>
> I am currently using bzr to manage revision of my /etc config files on
> my servers.
> Onces the commit has been made, a mail is sent through bzr-email to a
> mailing list so that the other admins are notified about the
> modifications.
>
> Sadly, the url given by the branch.base info only contains file:///etc
> and thus the hostname does not appears on the subject.
> This requires me each time to specify the hostname on the subject (first
> line of the commit).
>
> The included patch offers the option to set subject_include_hostname to
> bazaar.conf so that the hostname appears in the subject. Module
> documentation reflects this change too.
Thanks, that sounds useful.
> === modified file '__init__.py'
> --- __init__.py 2008-12-09 20:09:15 +0000
> +++ __init__.py 2008-12-14 17:39:50 +0000
> @@ -40,6 +40,9 @@
> - If the configuration value 'public_branch' is set, it is used.
> - The URL of the branch itself.
>
> +The hostname may be added to the subject, as it could be usefull for localization of local commit. By default the hostname will not appear in the subject.
Spelled 'useful'.
> + - Set subject_include_hostname = true in bazaar.conf
> +
> Setting public_branch is highly recommended if you commit via a protocol which
> has a private address (e.g. bzr+ssh but anonymous access might be bzr:// or
> http://).
>
> === modified file 'emailer.py'
> --- emailer.py 2008-12-09 20:09:15 +0000
> +++ emailer.py 2008-12-14 17:25:24 +0000
> @@ -248,10 +248,19 @@
> self.send()
>
> def subject(self):
> - return ("Rev %d: %s in %s" %
> - (self.revno,
> - self.revision.get_summary(),
> - self.url()))
> + subject_include_hostname = self.config.get_user_option('subject_include_hostname')
> + if subject_include_hostname is None or subject_include_hostname.lower() == 'false':
Isn't there a better way to get a boolean config value than coding this
here?
> + return ("Rev %d: %s in %s" %
> + (self.revno,
> + self.revision.get_summary(),
> + self.url()))
> + else:
> + from socket import gethostname
> + return ("Rev %d: %s in %s on %s" %
> + (self.revno,
> + self.revision.get_summary(),
> + self.url(),
> + gethostname()))
>
> def diff_filename(self):
> return "patch-%s.diff" % (self.revno,)
>
--
Martin <http://launchpad.net/~mbp>
More information about the bazaar
mailing list