"bzr commit" empty message error comes too late

Bug #207507 reported by Stefan Monnier
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Paul Stewart

Bug Description

Here is an example session:

  % bzr commit -m ''
  Committing to: /home/monnier/tmp/bzr/work/
  modified lisp/simple.el
  modified src/coding.c
  modified src/data.c
  modified src/indent.c
  modified src/keyboard.c
  modified src/keymap.c
  bzr: ERROR: empty commit message specified
  %

as you can see, the error message about the fact that the commit message is empty only comes at the very end. Much better would be to fail immediately. Believe or not, I "committed" my changes twice before noticing that they weren't being committed.

Tags: easy

Related branches

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 207507] [NEW] "bzr commit" empty message error comes too late

On Thu, 2008-03-27 at 01:44 +0000, Stefan Monnier wrote:
> Public bug reported:
>
> Here is an example session:
>
> % bzr commit -m ''
> Committing to: /home/monnier/tmp/bzr/work/
> modified lisp/simple.el
> modified src/coding.c
> modified src/data.c
> modified src/indent.c
> modified src/keyboard.c
> modified src/keymap.c
> bzr: ERROR: empty commit message specified
> %
>
> as you can see, the error message about the fact that the commit message
> is empty only comes at the very end. Much better would be to fail
> immediately. Believe or not, I "committed" my changes twice before
> noticing that they weren't being committed.

We check the message at the end because when it is being obtained
interactively, creating a complex message is something we shouldn't
force the user to do twice - *and* the prompt we give the user may
contain the actual diff being committed so the user can see what is
being recorded.

It is possible to special case this I guess, but I wonder if it
necessary.

-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Revision history for this message
Stefan Monnier (monnier) wrote :

Maybe the simpler and better option is to not signal an error if the user specified an empty -m argument.

Revision history for this message
John A Meinel (jameinel) wrote :

It would be pretty trivial to just check if "message == ''" in the beginning of cmd_commit.run() and fail at that time, since we know we will abort later.

Though allowing an empty commit message would also be possible (even if it is bad form on the user's part).

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Stefan Monnier (monnier) wrote : Re: [Bug 207507] Re: "bzr commit" empty message error comes too late

> Though allowing an empty commit message would also be possible (even if
> it is bad form on the user's part).

It's not always bad form. You can use revision control systems to
implement a poor-man's distributed filesystem with disconnected
operation, and then a script does a pull&commit&push. The script has no
idea what comment to use, so '' is a very wise choice.

In any case, if the user went through the trouble of writing "-m ''"
it's pretty likely he really means it (whether you agree with his
choice or not).

        Stefan

Revision history for this message
David 'skOre' Deutsch (skore-skore) wrote :

What about giving the user a quick hand? The current error is:

bzr: ERROR: empty commit message specified

Maybe this would give more instant help:

bzr: ERROR: empty commit message specified. Add "-m 'message'" to enter a commit message. You can leave it empty with "-m ''".

I know it takes only a 2 to 5 minute lookup to figure this out yourself, but it wouldn't hurt, right?

Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Revision history for this message
Paul Stewart (paulbrianstewart) wrote :

Hi Martin,

I have updated the bzr.bzrlib.builtins.py file to include the message that David recommended in message #5.

Attached is the file and I will push the code back up to lp:bzr and lp:ubuntu/bzr for your merge consideration.

Hope this helps
Thanks
Paul Stewart

Revision history for this message
Paul Stewart (paulbrianstewart) wrote :
Changed in bzr:
status: Confirmed → In Progress
Revision history for this message
Paul Stewart (paulbrianstewart) wrote :

@Jelmer,

Hi, I see that the merge has a status of 'needs fixing'....did the code not work? What do I need to do to fix it?

Thanks
Paul

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Paul,

See my comments in the merge proposal. Once the branch has been updated, please click "request another review" on the merge proposal page.

Changed in bzr:
status: In Progress → Confirmed
Revision history for this message
Paul Stewart (paulbrianstewart) wrote :

Hi Jelmer,

I have updated the code as you suggested. When you have time please review it and let me know if you need me to do anything else.

Thanks
Paul Stewart

Changed in bzr:
status: Confirmed → Fix Committed
Vincent Ladeuil (vila)
Changed in bzr:
status: Fix Committed → Fix Released
milestone: none → 2.5b1
Jelmer Vernooij (jelmer)
Changed in bzr:
assignee: nobody → Paul Stewart (paulbrianstewart)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.