~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    config,
28
28
    osutils,
29
29
    trace,
 
30
    transport,
 
31
    ui,
30
32
    )
31
33
from bzrlib.errors import BzrError, BadCommitMessageEncoding
32
34
from bzrlib.hooks import HookPoint, Hooks
139
141
    try:
140
142
        msgfilename, hasinfo = _create_temp_file_with_commit_template(
141
143
                                    infotext, ignoreline, start_message)
142
 
 
143
 
        if not msgfilename or not _run_editor(msgfilename):
144
 
            return None
145
 
 
 
144
        if not msgfilename:
 
145
            return None
 
146
        basename = osutils.basename(msgfilename)
 
147
        msg_transport = transport.get_transport(osutils.dirname(msgfilename))
 
148
        reference_content = msg_transport.get_bytes(basename)
 
149
        if not _run_editor(msgfilename):
 
150
            return None
 
151
        edited_content = msg_transport.get_bytes(basename)
 
152
        if edited_content == reference_content:
 
153
            if not ui.ui_factory.get_boolean(
 
154
                "Commit message was not edited, use anyway"):
 
155
                # Returning "" makes cmd_commit raise 'empty commit message
 
156
                # specified' which is a reasonable error, given the user has
 
157
                # rejected using the unedited template.
 
158
                return ""
146
159
        started = False
147
160
        msg = []
148
161
        lastline, nlines = 0, 0