# # # patch "NEWS" # from [8fa4b8f1e140f875e4639c15235cedf35c31892a] # to [f6dc9547c2093be41cb2a25e6bd1236c8c793d7b] # # patch "cmd_ws_commit.cc" # from [1deb2ac39e8c0fe5935d7842e561bda6e591ea97] # to [80bed2c83bd1148c2b374258431be11e102331e4] # # patch "tests/changelog_editor/__driver__.lua" # from [f891608f0776e2ff3e5e58296b53647fff41c5f2] # to [fcbab27fa375573e63a9d2d33b28196c9b09285d] # # patch "tests/changelog_editor/changelog.lua" # from [395e1d1d8755263c93cd5f66486baa1d5e7957a4] # to [0f572fde86fd0535c7de4dd06c8dbd29721d3057] # ============================================================ --- NEWS 8fa4b8f1e140f875e4639c15235cedf35c31892a +++ NEWS f6dc9547c2093be41cb2a25e6bd1236c8c793d7b @@ -61,6 +61,10 @@ Xxx Xxx 99 99:99:99 UTC 2010 Bugs Fixed + - monotone now tries harder to find the cancel hint in a commit + message and only aborts if it can't find it anywhere + (fixes monotone bug #30215) + Other Sun Jun 13 22:13:53 UTC 2010 ============================================================ --- cmd_ws_commit.cc 1deb2ac39e8c0fe5935d7842e561bda6e591ea97 +++ cmd_ws_commit.cc 80bed2c83bd1148c2b374258431be11e102331e4 @@ -260,6 +260,14 @@ get_log_message_interactively(lua_hooks system_to_utf8(output_message, full_message); + // look for the cancel notification anywhere in the text. + // this might be needed in case the user moves it down accidentially + // and the previous instructions are kept intact + if (full_message().find(cancel()) == string::npos) + { + E(false, origin::user, F("Commit cancelled.")); + } + // save the message in _MTN/commit so its not lost if something fails below work.save_commit_text(full_message); @@ -277,13 +285,8 @@ get_log_message_interactively(lua_hooks E(message.read(instructions()), origin::user, F("Commit failed. Instructions not found.")); - if (!message.read(cancel())) - { - // clear the backup file if the commit was explicitly cancelled - work.clear_commit_text(); - E(message.read(cancel()), origin::user, - F("Commit cancelled.")); - } + E(message.read(cancel()), origin::user, + F("Commit failed. Cancel hint not found.")); utf8 const AUTHOR(trim_right(_("Author: ")).c_str()); utf8 const DATE(trim_right(_("Date: ")).c_str()); ============================================================ --- tests/changelog_editor/__driver__.lua f891608f0776e2ff3e5e58296b53647fff41c5f2 +++ tests/changelog_editor/__driver__.lua fcbab27fa375573e63a9d2d33b28196c9b09285d @@ -48,11 +48,20 @@ remove("_MTN/commit") -- commit can be cancelled -writefile("_MTN/log", "cancel") +writefile("_MTN/log", "cancel hint removed") check(mtn("commit", "--rcfile=changelog.lua"), 1, false, true) check(qgrep("Commit cancelled.", "stderr")) check(not exists("_MTN/commit")) +-- and we notice if the cancel message is still intact and +-- hasn't been moved + +writefile("_MTN/log", "cancel hint moved") +check(mtn("commit", "--rcfile=changelog.lua"), 1, false, true) +check(qgrep("Cancel hint not found.", "stderr")) +check(exists("_MTN/commit")) +remove("_MTN/commit") + -- commit fails with modified/missing separator, Revision: or Parent: lines writefile("_MTN/log", "missing separator") ============================================================ --- tests/changelog_editor/changelog.lua 395e1d1d8755263c93cd5f66486baa1d5e7957a4 +++ tests/changelog_editor/changelog.lua 0f572fde86fd0535c7de4dd06c8dbd29721d3057 @@ -6,8 +6,10 @@ function edit_comment(user_log_file) return string.gsub(user_log_file, "\nempty message\n", "") elseif (string.find(user_log_file, "\nmissing instructions\n")) then return "foobar" .. user_log_file - elseif (string.find(user_log_file, "\ncancel\n")) then + elseif (string.find(user_log_file, "\ncancel hint removed\n")) then return string.gsub(user_log_file, "... REMOVE THIS LINE TO CANCEL THE COMMIT ...\n", "") + elseif (string.find(user_log_file, "\ncancel hint moved\n")) then + return string.gsub(user_log_file, "(... REMOVE THIS LINE TO CANCEL THE COMMIT ...)", "\n\n%1") elseif (string.find(user_log_file, "\nmissing separator\n")) then return string.gsub(user_log_file, "---------------\n", "\n") elseif (string.find(user_log_file, "\nmissing revision\n")) then