/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: 2018-11-12 01:41:38 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181112014138-3b0zyx91cu3wdq3k
More PEP8 fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
 
48
48
def _get_editor():
49
 
    """Return a sequence of possible editor binaries for the current platform"""
 
49
    """Return sequence of possible editor binaries for the current platform"""
50
50
    try:
51
51
        yield os.environ["BRZ_EDITOR"], '$BRZ_EDITOR'
52
52
    except KeyError:
73
73
    for candidate, candidate_source in _get_editor():
74
74
        edargs = cmdline.split(candidate)
75
75
        try:
76
 
            ## mutter("trying editor: %r", (edargs +[filename]))
77
76
            x = call(edargs + [filename])
78
77
        except OSError as e:
79
78
            if candidate_source is not None:
121
120
    :return:    commit message or None.
122
121
    """
123
122
 
124
 
    if not start_message is None:
 
123
    if start_message is not None:
125
124
        start_message = start_message.encode(osutils.get_user_encoding())
126
125
    infotext = infotext.encode(osutils.get_user_encoding(), 'replace')
127
126
    return edit_commit_message_encoded(infotext, ignoreline, start_message)
307
306
        These are all empty initially.
308
307
        """
309
308
        Hooks.__init__(self, "breezy.msgeditor", "hooks")
310
 
        self.add_hook('set_commit_message',
311
 
                      "Set a fixed commit message. "
312
 
                      "set_commit_message is called with the "
313
 
                      "breezy.commit.Commit object (so you can also change e.g. revision "
314
 
                      "properties by editing commit.builder._revprops) and the message "
315
 
                      "so far. set_commit_message must return the message to use or None"
316
 
                      " if it should use the message editor as normal.", (2, 4))
317
 
        self.add_hook('commit_message_template',
318
 
                      "Called when a commit message is being generated. "
319
 
                      "commit_message_template is called with the breezy.commit.Commit "
320
 
                      "object and the message that is known so far. "
321
 
                      "commit_message_template must return a new message to use (which "
322
 
                      "could be the same as it was given). When there are multiple "
323
 
                      "hooks registered for commit_message_template, they are chained "
324
 
                      "with the result from the first passed into the second, and so "
325
 
                      "on.", (1, 10))
 
309
        self.add_hook(
 
310
            'set_commit_message',
 
311
            "Set a fixed commit message. "
 
312
            "set_commit_message is called with the "
 
313
            "breezy.commit.Commit object (so you can also change e.g. "
 
314
            "revision properties by editing commit.builder._revprops) and the "
 
315
            "message so far. set_commit_message must return the message to "
 
316
            "use or None if it should use the message editor as normal.",
 
317
            (2, 4))
 
318
        self.add_hook(
 
319
            'commit_message_template',
 
320
            "Called when a commit message is being generated. "
 
321
            "commit_message_template is called with the breezy.commit.Commit "
 
322
            "object and the message that is known so far. "
 
323
            "commit_message_template must return a new message to use (which "
 
324
            "could be the same as it was given). When there are multiple "
 
325
            "hooks registered for commit_message_template, they are chained "
 
326
            "with the result from the first passed into the second, and so "
 
327
            "on.", (1, 10))
326
328
 
327
329
 
328
330
hooks = MessageEditorHooks()