~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 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(), """
21
23
from bzrlib import (
22
24
    branch as _mod_branch,
23
25
    diff,
 
26
    email_message,
24
27
    errors,
25
28
    gpg,
26
29
    hooks,
34
37
from bzrlib.bundle import (
35
38
    serializer as bundle_serializer,
36
39
    )
37
 
from bzrlib.email_message import EmailMessage
 
40
""")
38
41
 
39
42
 
40
43
class MergeRequestBodyParams(object):
56
59
    """Hooks for MergeDirective classes."""
57
60
 
58
61
    def __init__(self):
59
 
        hooks.Hooks.__init__(self)
60
 
        self.create_hook(hooks.HookPoint('merge_request_body',
 
62
        hooks.Hooks.__init__(self, "bzrlib.merge_directive", "BaseMergeDirective.hooks")
 
63
        self.add_hook('merge_request_body',
61
64
            "Called with a MergeRequestBodyParams when a body is needed for"
62
65
            " a merge request.  Callbacks must return a body.  If more"
63
66
            " than one callback is registered, the output of one callback is"
64
 
            " provided to the next.", (1, 15, 0), False))
 
67
            " provided to the next.", (1, 15, 0))
65
68
 
66
69
 
67
70
class BaseMergeDirective(object):
263
266
            body = self.to_signed(branch)
264
267
        else:
265
268
            body = ''.join(self.to_lines())
266
 
        message = EmailMessage(mail_from, mail_to, subject, body)
 
269
        message = email_message.EmailMessage(mail_from, mail_to, subject,
 
270
            body)
267
271
        return message
268
272
 
269
273
    def install_revisions(self, target_repo):