Merge lp:~jelmer/bzr-email/drop-pre-0.15 into lp:bzr-email

Proposed by Jelmer Vernooij
Status: Merged
Approved by: John A Meinel
Approved revision: 45
Merged at revision: 48
Proposed branch: lp:~jelmer/bzr-email/drop-pre-0.15
Merge into: lp:bzr-email
Diff against target: 50 lines (+3/-26)
1 file modified
__init__.py (+3/-26)
To merge this branch: bzr merge lp:~jelmer/bzr-email/drop-pre-0.15
Reviewer Review Type Date Requested Status
Bazaar Developers Pending
Review via email: mp+49628@code.launchpad.net

Description of the change

Drop some magic to cope with pre-0.15 versions of bzr.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/14/2011 8:14 AM, Jelmer Vernooij wrote:
> Jelmer Vernooij has proposed merging lp:~jelmer/bzr-email/drop-pre-0.15 into lp:bzr-email.
>
> Requested reviews:
> Bazaar Developers (bzr)
>
> For more details, see:
> https://code.launchpad.net/~jelmer/bzr-email/drop-pre-0.15/+merge/49628
>
> Drop some magic to cope with pre-0.15 versions of bzr.

If I'm reading the diff correctly, you are completely removing the call
to install the bzr-email post commit hook, without installing it a
different way. Am I missing something? (I'm fine with removing the
getattr stuff in favor of 0.15, but the rest?)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1ZY2kACgkQJdeBCYSNAAO9pQCeNfIe8Wcqx4qCa0EprBgghA2B
CpAAoNFKEscddEHJjYxcLuFpL1UUr7Qq
=Eaj6
-----END PGP SIGNATURE-----

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> On 2/14/2011 8:14 AM, Jelmer Vernooij wrote:
> > Jelmer Vernooij has proposed merging lp:~jelmer/bzr-email/drop-pre-0.15 into
> lp:bzr-email.
> >
> > Requested reviews:
> > Bazaar Developers (bzr)
> >
> > For more details, see:
> > https://code.launchpad.net/~jelmer/bzr-email/drop-pre-0.15/+merge/49628
> >
> > Drop some magic to cope with pre-0.15 versions of bzr.
>
>
> If I'm reading the diff correctly, you are completely removing the call
> to install the bzr-email post commit hook, without installing it a
> different way. Am I missing something? (I'm fine with removing the
> getattr stuff in favor of 0.15, but the rest?)
The hooks are now installed inline at the bottom of the file, rather than from a function.

Cheers,

jelmer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2010-10-09 23:15:45 +0000
3+++ __init__.py 2011-02-14 14:14:25 +0000
4@@ -84,8 +84,6 @@
5
6 def post_commit(branch, revision_id):
7 """This is the post_commit hook that should get run after commit."""
8- if not use_legacy:
9- return
10 _emailer.EmailSender(branch, revision_id, branch.get_config()).send_maybe()
11
12
13@@ -102,20 +100,6 @@
14 params.branch.get_config(), local_branch=None, op='change').send_maybe()
15
16
17-def install_hooks():
18- """Install CommitSender to send after commits with bzr >= 0.15 """
19- install_named_hook = getattr(Branch.hooks, 'install_named_hook', None)
20- if install_named_hook is not None:
21- install_named_hook('post_commit', branch_commit_hook, 'bzr-email')
22- if 'post_change_branch_tip' in Branch.hooks:
23- install_named_hook('post_change_branch_tip',
24- branch_post_change_hook, 'bzr-email')
25- else:
26- Branch.hooks.install_hook('post_commit', branch_commit_hook)
27- if getattr(Branch.hooks, 'name_hook', None) is not None:
28- Branch.hooks.name_hook(branch_commit_hook, "bzr-email")
29-
30-
31 def test_suite():
32 from unittest import TestSuite
33 import bzrlib.plugins.email.tests
34@@ -124,13 +108,6 @@
35 return result
36
37
38-# setup the email plugin with > 0.15 hooks.
39-try:
40- install_hooks()
41- use_legacy = False
42-except AttributeError:
43- # bzr < 0.15 - no Branch.hooks
44- use_legacy = True
45-except errors.UnknownHook:
46- # bzr 0.15 dev before post_commit was added
47- use_legacy = True
48+Branch.hooks.install_named_hook('post_commit', branch_commit_hook, 'bzr-email')
49+Branch.hooks.install_named_hook('post_change_branch_tip', branch_post_change_hook,
50+ 'bzr-email')

Subscribers

People subscribed via source and target branches