I believe the attached patch fixes the broken test cases for the magic
line patch.
It looks like the wrong mkdir patch may have been applied to the tree
also, causing that test to fail. I submitted two attempts at that
patch (the first not including the tests...before morning coffee).
The second one included the tests and should work.
As for the api surrounding the edit_comment hook, could a user wanting
to override the hook not just strip the line in their localized text?
I may be missing something here?
Thanks
-Ben
On 12/15/06, Nathaniel J. Smith <[EMAIL PROTECTED]> wrote:
On Fri, Dec 15, 2006 at 08:57:36AM -0500, Ben Walton wrote:
> I actually looked at implementing this inside the hook, but chose the
> c++ route for the following reason. I may be off base here with my
> reasoning, so let me know if you agree/disagree:
>
> Doing this in the c++ code leaves a hook writer the responsiblity of
> explicitly removing the 'magic' line if they wish to disable the
> feature. Implementing this in the lua hook leaves the hook writer the
> implicit resposibility of providing the feature if they override the
> hook. Now in reality, the difference is small. I just felt that from
> a UI perspective, it's better to make a user responsible for explicit
> rather than implicit actions.
I see your point. I was thinking more in terms of usable apis, it's
actually really hard for a hook to programmatically detect the "magic"
line and remove it, once it is mixed in with the rest of comment. I'm
not sure how one would actually do this (especially keeping in mind
that we may change the phrasing, the string may occur in translated
form, etc.).
I think the bottom line is that it doesn't actually matter that much,
the commit message hook stuff is a bit of a mess anyway, there are
already things like the C++ generates the message about lines with
"MTN:" in front being removed, but it's the hook that actually defines
the MTN: prefixing/removal mechanism, etc... so basically, I would
just go with whatever is easiest.
-- Nathaniel
--
---------------------------------------------------------------------------------------------------------------------------
Ben Walton <[EMAIL PROTECTED]>
Unanswered questions are far less dangerous than unquestioned answers.
- The Roadside Pulpit
---------------------------------------------------------------------------------------------------------------------------
#
# old_revision [54119e70f419adcf93220d2d15c2aec042a44a98]
#
# patch "tests/checkout_creates__MTN_log/commit_log.lua"
# from [09c926209c317efc447dbe6448fe891c2d86e958]
# to [a9af6de4500c2fddab1853eebc185a055156f8cd]
#
# patch "tests/commit_using__MTN_log/__driver__.lua"
# from [527603c2d0931a7576c34088d085ac689cf93236]
# to [a9b708bd811300cc5c4ca78b932f50f7f93341cf]
#
# patch "tests/i18n_commit_messages/extra_hooks.lua"
# from [2fdc779f672bc3e26ec390f6413f2d13778bc30d]
# to [ca81a1f657530409dbbe1ec50b52a9e253b0f411]
#
============================================================
--- tests/checkout_creates__MTN_log/commit_log.lua 09c926209c317efc447dbe6448fe891c2d86e958
+++ tests/checkout_creates__MTN_log/commit_log.lua a9af6de4500c2fddab1853eebc185a055156f8cd
@@ -1,3 +1,6 @@ function edit_comment(summary, user_log_
function edit_comment(summary, user_log_file)
- return 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"
end
============================================================
--- tests/commit_using__MTN_log/__driver__.lua 527603c2d0931a7576c34088d085ac689cf93236
+++ tests/commit_using__MTN_log/__driver__.lua a9b708bd811300cc5c4ca78b932f50f7f93341cf
@@ -26,4 +26,4 @@ check(mtn("ls", "certs", tsha), 0, true,
check(exists("_MTN/log"))
check(fsize("_MTN/log") == 0)
check(mtn("ls", "certs", tsha), 0, true, false)
+check(qgrep("Log Entry", "stdout"))
-check(qgrep('Log entry', "stdout"))
============================================================
--- tests/i18n_commit_messages/extra_hooks.lua 2fdc779f672bc3e26ec390f6413f2d13778bc30d
+++ tests/i18n_commit_messages/extra_hooks.lua ca81a1f657530409dbbe1ec50b52a9e253b0f411
@@ -7,6 +7,14 @@ function edit_comment(basetext, user_log
-- 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
+
wanted = slurp("euc-jp.txt")
if string.find(basetext, wanted) ~= nil then
_______________________________________________
Monotone-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monotone-devel