~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-11 11:47:36 UTC
  • mfrom: (5200.3.8 lock_return)
  • Revision ID: pqm@pqm.ubuntu.com-20100511114736-mc1sq9zyo3vufec7
(lifeless) Provide a consistent interface to Tree, Branch,
 Repository where lock methods return an object with an unlock method to
 unlock the lock. This breaks the API for Branch,
 Repository on their lock_write methods. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
from StringIO import StringIO
19
19
import re
20
20
 
21
 
from bzrlib import lazy_import
22
 
lazy_import.lazy_import(globals(), """
23
21
from bzrlib import (
24
22
    branch as _mod_branch,
25
23
    diff,
26
 
    email_message,
27
24
    errors,
28
25
    gpg,
29
26
    hooks,
37
34
from bzrlib.bundle import (
38
35
    serializer as bundle_serializer,
39
36
    )
40
 
""")
 
37
from bzrlib.email_message import EmailMessage
41
38
 
42
39
 
43
40
class MergeRequestBodyParams(object):
59
56
    """Hooks for MergeDirective classes."""
60
57
 
61
58
    def __init__(self):
62
 
        hooks.Hooks.__init__(self, "bzrlib.merge_directive", "BaseMergeDirective.hooks")
63
 
        self.add_hook('merge_request_body',
 
59
        hooks.Hooks.__init__(self)
 
60
        self.create_hook(hooks.HookPoint('merge_request_body',
64
61
            "Called with a MergeRequestBodyParams when a body is needed for"
65
62
            " a merge request.  Callbacks must return a body.  If more"
66
63
            " than one callback is registered, the output of one callback is"
67
 
            " provided to the next.", (1, 15, 0))
 
64
            " provided to the next.", (1, 15, 0), False))
68
65
 
69
66
 
70
67
class BaseMergeDirective(object):
266
263
            body = self.to_signed(branch)
267
264
        else:
268
265
            body = ''.join(self.to_lines())
269
 
        message = email_message.EmailMessage(mail_from, mail_to, subject,
270
 
            body)
 
266
        message = EmailMessage(mail_from, mail_to, subject, body)
271
267
        return message
272
268
 
273
269
    def install_revisions(self, target_repo):