monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Monotone Commit Template


From: Pablo Delgado
Subject: Re: [Monotone-devel] Monotone Commit Template
Date: Tue, 25 Sep 2007 00:04:49 -0400
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Nathaniel Smith wrote:
On Sun, Sep 23, 2007 at 06:45:14PM +0200, Ralf S. Engelschall wrote:
On Sun, Sep 23, 2007, Nathaniel Smith wrote:
This is broken, unfortunately -- e.g., if the user starts a commit,
aborts it, then tries again, they will end up with multiple copies of
the template in their log message.
Really? I tried it multiple times and I aborted by just using ":q!"
from Vim and I never have seen the message accumulating. It worked just
fine. The Lua function intentionally just copies .mtn-message into the
_temporary_ file, not into _MTN/log.

Yes, but on a failed/aborted commit, monotone saves whatever was
written to the log message back into _MTN/log, so that when the user
tries again after fixing whatever problem they had, their log message
will pop back up.  ...I don't know why that wasn't happening for you.
For that matter, I don't understand how doing ":q!" would have aborted
anything; it is supposed to abort only if the user has not written
anything to the log, and in this case, it looks exactly as if the user
*has* written something, i.e. whatever was in .mtn-message.

This of course is a bug, the "abort commit if log message is empty"
logic should be extended to "abort commit if log message is empty or
equal to .mtn-message", but I don't see this extension in the patch
you posted.  ...Or maybe if we implemented things the way I suggest,
by copying .mtn-message into _MTN/log, then this wouldn't be
necessary, because having _MTN/log non-empty triggers the thing where
it wants you to confirm the commit by deleting a magic line.  Dunno.
Anyway, I don't understand the behavior you describe at all.

[...]
What charset should .mtn-message be interpreted to be in, current user
preferred charset or always-utf8?  Always-utf8 seems more viable,
though I'm sure it will bite someone at some point.
Can we control this in the Lua hook at all?

I don't think so, the charset conversion stuff could in principle be
exposed to lua, but IIRC it isn't ATM.

I think the right place to do this is in the core _MTN/log / commit
message handling code, though, as per above, and that code is already
perfectly smart about charsets.

-- Nathaniel

I was looking through the code and found in /cmd_ws_commit.cc/ a segment of code were it builds the current commit message in a function called /get_log_message_interactively/ which is used by the function /commit/. Would it be best to write a new function to get the template message from .mtn-message and modify the logic in /commit/ to check if the project has a predefined template, which it uses and can append the info in _MTN/log as well, or modify the logic within /
get_log_message_interactively/.

I am assuming this is the core commit handling code. Yes /No?

-- Pablo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]