# # # patch "cmd_ws_commit.cc" # from [16c7d171d276058868ae4d5d94bdecfee634e8f9] # to [2cfb24493d72d89860af3c130316864b35d6fdf8] # # patch "tests/checkout_creates__MTN_log/commit_log.lua" # from [a9af6de4500c2fddab1853eebc185a055156f8cd] # to [50b7346f7b34b2b15d61af4c791a43748de9f6c5] # # patch "tests/clone_creates__MTN_log/commit_log.lua" # from [a9af6de4500c2fddab1853eebc185a055156f8cd] # to [50b7346f7b34b2b15d61af4c791a43748de9f6c5] # # patch "tests/commit_using__MTN_log/__driver__.lua" # from [a9b708bd811300cc5c4ca78b932f50f7f93341cf] # to [6c332cd36e7f489cb92bfdddff76b7703d5cbe12] # # patch "tests/commit_using__MTN_log/commit_log.lua" # from [09c926209c317efc447dbe6448fe891c2d86e958] # to [e1b07045d69de57d75e5b73df41124c2c94b315d] # # patch "tests/commit_using__MTN_log/commit_log_modified_return.lua" # from [a9af6de4500c2fddab1853eebc185a055156f8cd] # to [563af655ad86ba719907f8d4d24a7174f90b15e7] # # patch "tests/commit_writes_message_back_to__MTN_log/__driver__.lua" # from [7758bd1d4316f2c3e80cc4018a4b3ab4067137b7] # to [0f20f06596df2619cb17794e0243c9a5a7927604] # # patch "tests/commit_writes_message_back_to__MTN_log/my_hook.lua" # from [2c27a968d793839ad3c7dade630eb58837ea2f79] # to [a8b4844456e4838329a7ad4ccf95f427718c1a2a] # # patch "tests/i18n_commit_messages/__driver__.lua" # from [2e3be837715a30fa20743f0f4a54fceaf4a7dbfe] # to [4d8c64139a02a00aa3a3aca1e2e703849adf4d15] # # patch "tests/i18n_commit_messages/euc-jp.txt" # from [e42d3979ee6d233a489f9a21697abf8786bc8b65] # to [0894414faade0c80e732c757474203f9de358469] # # patch "tests/i18n_commit_messages/extra_hooks.lua" # from [ca81a1f657530409dbbe1ec50b52a9e253b0f411] # to [d362248e82606a5ce55e6740c79608a275440438] # # patch "tests/i18n_commit_messages/utf8.txt" # from [681c6291b3f365c477e93d5bd77192d88253b486] # to [7cb4bf2f531c9b04b50e7c120e87465087b88cbd] # # patch "tests/wrong_options_override_workspace_options/__driver__.lua" # from [949a6e38cd83c5f621bfb9e474fb07fff28ab04e] # to [9779f7996358a9675c285e02f4c1769ca9ea5227] # ============================================================ --- cmd_ws_commit.cc 16c7d171d276058868ae4d5d94bdecfee634e8f9 +++ cmd_ws_commit.cc 2cfb24493d72d89860af3c130316864b35d6fdf8 @@ -59,7 +59,7 @@ revision_header(revision_id rid, revisio out << "Author: " << author << "\n" << "Date: " << date << "\n" << "Branch: " << branch << "\n" - << "Changelog: \n\n"; + << "Changelog:\n\n"; header = utf8(out.str()); } @@ -78,6 +78,8 @@ revision_summary(revision_t const & rev, revision_id parent = edge_old_revision(*i); cset const & cs = edge_changes(*i); + out += "\n"; + // A colon at the end of this string looked nicer, but it made // double-click copying from terminals annoying. // FIXME: this is not great for root commits, with no parent rev id @@ -163,8 +165,9 @@ get_log_message_interactively(lua_hooks external input_message; external output_message; + utf8_to_system_best_effort(full_message, input_message); - + N(lua.hook_edit_comment(input_message, output_message), F("edit of log message failed")); @@ -236,7 +239,7 @@ get_log_message_interactively(lua_hooks branch = branch_name(trim_ws(line->substr(8))); ++line; - N(line->find("Changelog: ") == 0, + N(*line == "Changelog:", F("Modifications outside of Author, Date, Branch or Changelog.\n" "Commit failed (missing changelog).")); ============================================================ --- tests/checkout_creates__MTN_log/commit_log.lua a9af6de4500c2fddab1853eebc185a055156f8cd +++ tests/checkout_creates__MTN_log/commit_log.lua 50b7346f7b34b2b15d61af4c791a43748de9f6c5 @@ -1,6 +1,3 @@ -function edit_comment(summary, user_log_file) - -- this used to just return the variable user_log_file, - -- but now must return the original entry without the 'magic' line. - -- this avoids a failing test after the 'magic line' patch - return "Log Entry" +function edit_comment(user_log_file) + return string.gsub(user_log_file, "Changelog:\n\n\n", "Changelog:\n\nLog Entry\n") end ============================================================ --- tests/clone_creates__MTN_log/commit_log.lua a9af6de4500c2fddab1853eebc185a055156f8cd +++ tests/clone_creates__MTN_log/commit_log.lua 50b7346f7b34b2b15d61af4c791a43748de9f6c5 @@ -1,6 +1,3 @@ -function edit_comment(summary, user_log_file) - -- this used to just return the variable user_log_file, - -- but now must return the original entry without the 'magic' line. - -- this avoids a failing test after the 'magic line' patch - return "Log Entry" +function edit_comment(user_log_file) + return string.gsub(user_log_file, "Changelog:\n\n\n", "Changelog:\n\nLog Entry\n") end ============================================================ --- tests/commit_using__MTN_log/__driver__.lua a9b708bd811300cc5c4ca78b932f50f7f93341cf +++ tests/commit_using__MTN_log/__driver__.lua 6c332cd36e7f489cb92bfdddff76b7703d5cbe12 @@ -5,18 +5,17 @@ writefile("_MTN/log", "Log entry") check(get("commit_log_modified_return.lua")) writefile("_MTN/log", "Log entry") - writefile("input.txt", "version 0 of the file") check(mtn("add", "input.txt"), 0, false, false) --this should now fail, given that the log file has content and we don't --remove the 'magic' line -check(mtn("--branch=testbranch", "--rcfile=commit_log.lua", "commit"), 1, false, true) -check(qgrep('magic line; commit cancelled', "stderr")) +--check(mtn("--branch=testbranch", "--rcfile=commit_log.lua", "commit"), 1, false, true) +--check(qgrep('magic line; commit cancelled', "stderr")) -check(exists("_MTN/log")) -check(fsize("_MTN/log") > 0) +--check(exists("_MTN/log")) +--check(fsize("_MTN/log") > 0) --this should pass, as the lua hook now returns a string that doesn't contain --the 'magic' line ============================================================ --- tests/commit_using__MTN_log/commit_log.lua 09c926209c317efc447dbe6448fe891c2d86e958 +++ tests/commit_using__MTN_log/commit_log.lua e1b07045d69de57d75e5b73df41124c2c94b315d @@ -1,3 +1,3 @@ -function edit_comment(summary, user_log_file) +function edit_comment(user_log_file) return user_log_file end ============================================================ --- tests/commit_using__MTN_log/commit_log_modified_return.lua a9af6de4500c2fddab1853eebc185a055156f8cd +++ tests/commit_using__MTN_log/commit_log_modified_return.lua 563af655ad86ba719907f8d4d24a7174f90b15e7 @@ -1,6 +1,3 @@ -function edit_comment(summary, user_log_file) - -- this used to just return the variable user_log_file, - -- but now must return the original entry without the 'magic' line. - -- this avoids a failing test after the 'magic line' patch - return "Log Entry" +function edit_comment(user_log_file) + return string.gsub(user_log_file, "Log entry", "Log Entry") end ============================================================ --- tests/commit_writes_message_back_to__MTN_log/__driver__.lua 7758bd1d4316f2c3e80cc4018a4b3ab4067137b7 +++ tests/commit_writes_message_back_to__MTN_log/__driver__.lua 0f20f06596df2619cb17794e0243c9a5a7927604 @@ -4,6 +4,10 @@ addfile("testfile", "blah blah") addfile("testfile", "blah blah") +-- ensure that the public key this test uses exists in the database +-- before making it unwriteable +check(mtn("status"), 0, false, false) + -- Make it unwriteable, so our edit_comment hook will have a chance to -- run, but the overall commit will fail. (How do I know this will -- work? Well, it did...) ============================================================ --- tests/commit_writes_message_back_to__MTN_log/my_hook.lua 2c27a968d793839ad3c7dade630eb58837ea2f79 +++ tests/commit_writes_message_back_to__MTN_log/my_hook.lua a8b4844456e4838329a7ad4ccf95f427718c1a2a @@ -1,3 +1,3 @@ -function edit_comment(basetext, user_log_message) - return "foobar\n" +function edit_comment(user_log_file) + return string.gsub(user_log_file, "Changelog:\n\n\n", "Changelog:\n\nfoobar\n") end ============================================================ --- tests/i18n_commit_messages/__driver__.lua 2e3be837715a30fa20743f0f4a54fceaf4a7dbfe +++ tests/i18n_commit_messages/__driver__.lua 4d8c64139a02a00aa3a3aca1e2e703849adf4d15 @@ -35,7 +35,12 @@ check(qgrep("VALIDATE: REV GOOD", "stdou check(qgrep("VALIDATE: MSG GOOD", "stdout")) check(qgrep("VALIDATE: REV GOOD", "stdout")) +check(mtn("log"), 0, true, false) +eucjp = string.gsub(readfile("euc-jp.txt"), "\n", "") +check(qgrep(eucjp, "stdout")) + -- and if we look at the cert, it should be in unicode rev = base_revision() check(mtn("automate", "certs", rev), 0, true, false) -check(qgrep(readfile("utf8.txt"), "stdout")) +utf8 = string.gsub(readfile("utf8.txt"), "\n", "") +check(qgrep(utf8, "stdout")) ============================================================ --- tests/i18n_commit_messages/euc-jp.txt e42d3979ee6d233a489f9a21697abf8786bc8b65 +++ tests/i18n_commit_messages/euc-jp.txt 0894414faade0c80e732c757474203f9de358469 @@ -1 +1 @@ -¥ï¡¼¥¯¥¹¥Ú¡¼¥¹¤¬É¬ÍפǤ¹¤¬¤ß¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿ \ No newline at end of file +¥ï¡¼¥¯¥¹¥Ú¡¼¥¹¤¬É¬ÍפǤ¹¤¬¤ß¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿ ============================================================ --- tests/i18n_commit_messages/extra_hooks.lua ca81a1f657530409dbbe1ec50b52a9e253b0f411 +++ tests/i18n_commit_messages/extra_hooks.lua d362248e82606a5ce55e6740c79608a275440438 @@ -6,28 +6,21 @@ end end -- this should get the commit message in current locale -function edit_comment(basetext, user_log_message) - -- we now mangle this to become the same as the content of the text file, - -- as it will have the 'magic line' prepended to it, which will cause the - -- test to fail. - -- this is only done if the message was pre-specified in _MTN/log - if user_log_message ~= "" then - user_log_message = "¥ï¡¼¥¯¥¹¥Ú¡¼¥¹¤¬É¬ÍפǤ¹¤¬¤ß¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿" - end - +function edit_comment(user_log_message) wanted = slurp("euc-jp.txt") - if string.find(basetext, wanted) ~= nil then + -- this is looking for the euc-jp string as an attribute value + if string.find(user_log_message, wanted) ~= nil then io.write("EDIT: BASE GOOD\n") else io.write("EDIT: BASE BAD\n") end - if user_log_message == "" then + if string.find(user_log_message, "Changelog:\n\n\n") ~= nil then io.write("EDIT: MSG NONESUCH\n") - return wanted + return string.gsub(user_log_message, "Changelog:\n\n\n", "Changelog:\n\n" .. wanted .. "\n") else - if wanted == user_log_message then + if string.find(user_log_message, "Changelog:\n\n" .. wanted .. "\n") ~= nil then io.write("EDIT: MSG GOOD\n") else io.write("EDIT: MSG BAD\n") ============================================================ --- tests/i18n_commit_messages/utf8.txt 681c6291b3f365c477e93d5bd77192d88253b486 +++ tests/i18n_commit_messages/utf8.txt 7cb4bf2f531c9b04b50e7c120e87465087b88cbd @@ -1 +1 @@ -ワークスペースが必要ですがみつかりませんでした \ No newline at end of file +ワークスペースが必要ですがみつかりませんでした ============================================================ --- tests/wrong_options_override_workspace_options/__driver__.lua 949a6e38cd83c5f621bfb9e474fb07fff28ab04e +++ tests/wrong_options_override_workspace_options/__driver__.lua 9779f7996358a9675c285e02f4c1769ca9ea5227 @@ -17,7 +17,7 @@ check(mtn_ws_opts("add", "."), 0, false, -- FIXME: this silently succeeds in a newly created workspace and should -- fail as soon as there is at least one ancestor, but this is another -- cup of tea -check(mtn_ws_opts("status", "-d", "baz"), 0, false, false) +check(mtn_ws_opts("status", "-d", "baz"), 1, false, false) -- this should succeed if the original database is still set check(mtn_ws_opts("commit", "-m", "test"), 0, false, false) @@ -29,7 +29,7 @@ writefile("not_a_dir", "bla") check(mtn_ws_opts("attr", "set", ".", "foo", "bar"), 0, false, false) writefile("not_a_dir", "bla") -check(mtn_ws_opts("status", "--keydir", "not_a_dir"), 0, false, false) +check(mtn_ws_opts("status", "--keydir", "not_a_dir"), 1, false, false) check(mtn_ws_opts("commit", "-m", "another test"), 0, false, false)