[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Log message file (MT/log) patch
From: |
Nathaniel Smith |
Subject: |
Re: [Monotone-devel] Log message file (MT/log) patch |
Date: |
Sun, 20 Mar 2005 18:09:52 -0800 |
User-agent: |
Mutt/1.5.6+20040907i |
On Fri, Mar 18, 2005 at 07:12:19PM -0500, Jeremy Cowgar wrote:
> Nathaniel and I briefly discussed (on IRC) the possibility of monotone
> reading a log file during the commit to retrieve the commit message from
> instead of supplying it on the command line. We worked up a draft and I
> coded it. Here are the end results. I have not written any unit tests
> for this yet, but in my limited testing it functions correctly for
> everything I threw at it. I even included some preliminary docs on how
> to use it.
Very nice work!
> -function edit_comment(basetext)
> +function edit_comment(basetext, user_log_message)
> local exe = "vi"
> local visual = os.getenv("VISUAL")
> if (visual ~= nil) then exe = visual end
> @@ -74,6 +74,7 @@
> if (tmp == nil) then return nil end
> basetext = "MT: " .. string.gsub(basetext, "\n", "\nMT: ") .. "\n"
> tmp:write(basetext)
> + tmp:write(user_log_message)
> io.close(tmp)
I think I'd prefer to have the user_log_message go _first_ in the
file? Maybe I'm weird, but I usually write my message above the "MT:"
stuff, since that's where my cursor starts. Anyone else have a
preference here?
Think that's my only comment :-).
Particular edge cases it would be good to have tests for:
- things work smoothly if MT/log doesn't exist
- if MT/log is non-empty _and_ the user passes a message on the
command line, it should be an error. (The error message might
suggest they can simply delete MT/log if they don't want it, which
should work by the above unit test...)
- checkout and setup both create MT/log
Oh, also need to update the Hook Reference section of the manual.
And maybe mention this at the appropriate place in the tutorial...
-- Nathaniel
--
The Universe may / Be as large as they say
But it wouldn't be missed / If it didn't exist.
-- Piet Hein