~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
        if not msgfilename:
145
145
            return None
146
146
        basename = osutils.basename(msgfilename)
147
 
        msg_transport = transport.get_transport_from_path(osutils.dirname(msgfilename))
 
147
        msg_transport = transport.get_transport(osutils.dirname(msgfilename))
148
148
        reference_content = msg_transport.get_bytes(basename)
149
149
        if not _run_editor(msgfilename):
150
150
            return None
303
303
        These are all empty initially.
304
304
        """
305
305
        Hooks.__init__(self, "bzrlib.msgeditor", "hooks")
306
 
        self.add_hook('set_commit_message',
307
 
            "Set a fixed commit message. "
308
 
            "set_commit_message is called with the "
309
 
            "bzrlib.commit.Commit object (so you can also change e.g. revision "
310
 
            "properties by editing commit.builder._revprops) and the message "
311
 
            "so far. set_commit_message must return the message to use or None"
312
 
            " if it should use the message editor as normal.", (2, 4))
313
306
        self.add_hook('commit_message_template',
314
307
            "Called when a commit message is being generated. "
315
308
            "commit_message_template is called with the bzrlib.commit.Commit "
324
317
hooks = MessageEditorHooks()
325
318
 
326
319
 
327
 
def set_commit_message(commit, start_message=None):
328
 
    """Sets the commit message.
329
 
    :param commit: Commit object for the active commit.
330
 
    :return: The commit message or None to continue using the message editor
331
 
    """
332
 
    start_message = None
333
 
    for hook in hooks['set_commit_message']:
334
 
        start_message = hook(commit, start_message)
335
 
    return start_message
336
 
 
337
 
 
338
320
def generate_commit_message_template(commit, start_message=None):
339
321
    """Generate a commit message template.
340
322