/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/msgeditor.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from subprocess import call
24
24
import sys
25
25
 
26
 
from bzrlib import (
 
26
from breezy import (
27
27
    cmdline,
28
28
    config,
29
29
    osutils,
31
31
    transport,
32
32
    ui,
33
33
    )
34
 
from bzrlib.errors import BzrError, BadCommitMessageEncoding
35
 
from bzrlib.hooks import Hooks
 
34
from breezy.errors import BzrError, BadCommitMessageEncoding
 
35
from breezy.hooks import Hooks
36
36
 
37
37
 
38
38
def _get_editor():
39
39
    """Return a sequence of possible editor binaries for the current platform"""
40
40
    try:
41
 
        yield os.environ["BZR_EDITOR"], '$BZR_EDITOR'
 
41
        yield os.environ["BRZ_EDITOR"], '$BRZ_EDITOR'
42
42
    except KeyError:
43
43
        pass
44
44
 
82
82
        else:
83
83
            break
84
84
    raise BzrError("Could not start any editor.\nPlease specify one with:\n"
85
 
                   " - $BZR_EDITOR\n - editor=/some/path in %s\n"
 
85
                   " - $BRZ_EDITOR\n - editor=/some/path in %s\n"
86
86
                   " - $VISUAL\n - $EDITOR" % \
87
87
                    config.config_filename())
88
88
 
153
153
        if edited_content == reference_content:
154
154
            if not ui.ui_factory.confirm_action(
155
155
                u"Commit message was not edited, use anyway",
156
 
                "bzrlib.msgeditor.unchanged",
 
156
                "breezy.msgeditor.unchanged",
157
157
                {}):
158
158
                # Returning "" makes cmd_commit raise 'empty commit message
159
159
                # specified' which is a reasonable error, given the user has
256
256
    # the revision to be committed, then pause and ask the user to
257
257
    # confirm/write a message.
258
258
    from StringIO import StringIO       # must be unicode-safe
259
 
    from bzrlib.status import show_tree_status
 
259
    from breezy.status import show_tree_status
260
260
    status_tmp = StringIO()
261
261
    show_tree_status(working_tree, specific_files=specific_files,
262
262
                     to_file=status_tmp, verbose=True)
275
275
    # the revision to be committed, then pause and ask the user to
276
276
    # confirm/write a message.
277
277
    from StringIO import StringIO       # must be unicode-safe
278
 
    from bzrlib.diff import show_diff_trees
 
278
    from breezy.diff import show_diff_trees
279
279
 
280
280
    template = make_commit_message_template(working_tree, specific_files)
281
281
    template = template.encode(output_encoding, "replace")
303
303
 
304
304
        These are all empty initially.
305
305
        """
306
 
        Hooks.__init__(self, "bzrlib.msgeditor", "hooks")
 
306
        Hooks.__init__(self, "breezy.msgeditor", "hooks")
307
307
        self.add_hook('set_commit_message',
308
308
            "Set a fixed commit message. "
309
309
            "set_commit_message is called with the "
310
 
            "bzrlib.commit.Commit object (so you can also change e.g. revision "
 
310
            "breezy.commit.Commit object (so you can also change e.g. revision "
311
311
            "properties by editing commit.builder._revprops) and the message "
312
312
            "so far. set_commit_message must return the message to use or None"
313
313
            " if it should use the message editor as normal.", (2, 4))
314
314
        self.add_hook('commit_message_template',
315
315
            "Called when a commit message is being generated. "
316
 
            "commit_message_template is called with the bzrlib.commit.Commit "
 
316
            "commit_message_template is called with the breezy.commit.Commit "
317
317
            "object and the message that is known so far. "
318
318
            "commit_message_template must return a new message to use (which "
319
319
            "could be the same as it was given). When there are multiple "