commit message validation, or template commit form?
Matt Mackall
mpm at selenic.com
Tue Dec 19 14:00:40 UTC 2006
On Tue, Dec 19, 2006 at 10:47:44AM +0100, Georg wrote:
> Hi,
>
> I keep forgetting to supply some vital information, e.g. bug id references,
> in my commit messages.
>
> Is there a way to plug in some validation code for the commit message, e.g.
> some formal check whether a bug id was referenced? I'm not after a bullet
> proof solution that validates ticket numbers, checks whether they are
> assigned to me etc., a simple syntactical check of the message would be
> sufficient.
>
> Acutally it would even help if hg commit (or qct, for that matter ;-) )
> could present me with a default "fill in the blanks" kind of form when I
> commit.
>
> Does anyone have a feature or extension like this already?
Mercurial calls a user-defined program to edit commit messages. If
that program returns false, the commit is aborted.
Here's an example:
diff -r 33988aaa1652 hgeditor
--- a/hgeditor Sun Dec 17 22:16:57 2006 -0600
+++ b/hgeditor Tue Dec 19 08:08:57 2006 -0600
@@ -39,6 +39,7 @@ HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$
done
)
+cat `hg root`/.commit-template > "$HGTMP/msg"
cat "$1" > "$HGTMP/msg"
MD5=$(which md5sum 2>/dev/null) || \
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list