~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-29 11:07:14 UTC
  • mfrom: (5813.1.1 realname-can-be-empty)
  • Revision ID: pqm@pqm.ubuntu.com-20110429110714-wr9f71ea9600lvb6
(jelmer) Allow realname to be empty in tests. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-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
23
23
import sys
24
24
 
25
25
from bzrlib import (
 
26
    cmdline,
26
27
    config,
27
28
    osutils,
28
29
    trace,
30
31
    ui,
31
32
    )
32
33
from bzrlib.errors import BzrError, BadCommitMessageEncoding
33
 
from bzrlib.hooks import HookPoint, Hooks
 
34
from bzrlib.hooks import Hooks
34
35
 
35
36
 
36
37
def _get_editor():
59
60
def _run_editor(filename):
60
61
    """Try to execute an editor to edit the commit message."""
61
62
    for candidate, candidate_source in _get_editor():
62
 
        edargs = candidate.split(' ')
 
63
        edargs = cmdline.split(candidate)
63
64
        try:
64
65
            ## mutter("trying editor: %r", (edargs +[filename]))
65
66
            x = call(edargs + [filename])
301
302
 
302
303
        These are all empty initially.
303
304
        """
304
 
        Hooks.__init__(self)
305
 
        self.create_hook(HookPoint('commit_message_template',
 
305
        Hooks.__init__(self, "bzrlib.msgeditor", "hooks")
 
306
        self.add_hook('commit_message_template',
306
307
            "Called when a commit message is being generated. "
307
308
            "commit_message_template is called with the bzrlib.commit.Commit "
308
309
            "object and the message that is known so far. "
310
311
            "could be the same as it was given. When there are multiple "
311
312
            "hooks registered for commit_message_template, they are chained "
312
313
            "with the result from the first passed into the second, and so "
313
 
            "on.", (1, 10), None))
 
314
            "on.", (1, 10))
314
315
 
315
316
 
316
317
hooks = MessageEditorHooks()