140
141
msgfilename, hasinfo = _create_temp_file_with_commit_template(
141
142
infotext, ignoreline, start_message)
143
if not msgfilename or not _run_editor(msgfilename):
145
basename = osutils.basename(msgfilename)
146
msg_transport = transport.get_transport(osutils.dirname(msgfilename))
147
reference_content = msg_transport.get_bytes(basename)
148
if not _run_editor(msgfilename):
150
edited_content = msg_transport.get_bytes(basename)
151
if edited_content == reference_content:
152
if not ui.ui_factory.confirm_action(
153
"Commit message was not edited, use anyway",
154
"bzrlib.msgeditor.unchanged",
156
# Returning "" makes cmd_commit raise 'empty commit message
157
# specified' which is a reasonable error, given the user has
158
# rejected using the unedited template.
148
162
lastline, nlines = 0, 0
195
209
def _create_temp_file_with_commit_template(infotext,
196
210
ignoreline=DEFAULT_IGNORE_LINE,
198
213
"""Create temp file and write commit template in it.
200
:param infotext: Text to be displayed at bottom of message
201
for the user's reference;
202
currently similar to 'bzr status'.
203
The text is already encoded.
215
:param infotext: Text to be displayed at bottom of message for the
216
user's reference; currently similar to 'bzr status'. The text is
205
219
:param ignoreline: The separator to use above the infotext.
207
:param start_message: The text to place above the separator, if any.
208
This will not be removed from the message
209
after the user has edited it.
210
The string is already encoded
221
:param start_message: The text to place above the separator, if any.
222
This will not be removed from the message after the user has edited
223
it. The string is already encoded
212
225
:return: 2-tuple (temp file name, hasinfo)
215
228
tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
218
msgfilename = osutils.basename(msgfilename)
229
dir=tmpdir, text=True)
219
230
msgfile = os.fdopen(tmp_fileno, 'w')
221
232
if start_message is not None: