views:

135

answers:

3

Is there a way to configure Mercurial to allow for empty commit messages? If you try hg commit through the CLI without entering a commit message, the commit is canceled with: abort: empty commit message.

Now, I know that committing without a message is usually considered bad form, but does Mercurial allow it at all?

A: 

You can use just a space, but I'd really discourage it:

hg commit -m " "
Patrick Steele
Yeah, I was afraid that would be the result. Hoping there's another solution.
derekerdmann
@derekerdmannIt's not possible with the command line
tonfa
@tonfa Are you sure? Has that been documented anywhere?
derekerdmann
@derekerdmann No it's not documented, and I'm pretty sure we won't change the command line for that.
tonfa
@tonfa Oh, I didn't realized you'd worked on it. Why didn't you say so before? Thanks a ton! Looks like a space is the only way to go.
derekerdmann
@Patrick Just an FYI - using an actual space doesn't work; you need to have some other placeholder instead. I'm leaving your answer as the accepted one because it's still the right idea.
derekerdmann
@derekerdmann - Works for me under Mercurial 1.5.3. What version are you using? Maybe they've changed it in more recent versions to strip out whitespace as well.
Patrick Steele
@Patrick Steele - I'm running 1.6, that must be the difference.
derekerdmann
+2  A: 

If the problem is that you don't want to enter the -m "blah" part you can always set up an alias. e.g. in hgrc

[alias]
qcommit = commit -m "quick commit - no message"
jk
A: 

I don't want to type qcommit, I just want not to enter a message. I am also a single user on a project. Every day I code at work, and then code at home. Twice a day I have to think up a daft message for my future self.

The qcommit idea at least shows how easily we stupid users can avoid typing a stupid log message. Perhaps the mercurial developers should craftily ban such aliases. Well then we'll use the shell. C'mon, you can force a message from us by default, but let's end the games there.

James
Are you trying to answer the question?
derekerdmann