Merge lp:~jelmer/bzr/empty-commit-message into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jonathan Riddell
Approved revision: no longer in the source branch.
Merged at revision: 6081
Proposed branch: lp:~jelmer/bzr/empty-commit-message
Merge into: lp:bzr
Diff against target: 78 lines (+20/-9)
3 files modified
bzrlib/builtins.py (+5/-5)
bzrlib/tests/blackbox/test_commit.py (+11/-4)
doc/en/release-notes/bzr-2.5.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/empty-commit-message
Reviewer Review Type Date Requested Status
Jonathan Riddell (community) Approve
Review via email: mp+71315@code.launchpad.net

Commit message

Support forcing empty commit messages with -m.

Description of the change

Allow explicitly committing with an empty commit message.

Committing with an empty commit message by specifying one in the
editor still fails.

This is a prerequisite for:

https://code.launchpad.net/~paulbrianstewart/bzr/207507-bzr-commit-message/+merge/68921

To post a comment you must log in.
Revision history for this message
Jonathan Riddell (jr) wrote :

Approved with release note added

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

sent to pqm by email

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

sent to pqm by email

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

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2011-08-17 02:08:00 +0000
+++ bzrlib/builtins.py 2011-08-17 10:58:35 +0000
@@ -3327,11 +3327,11 @@
3327 if my_message is None:3327 if my_message is None:
3328 raise errors.BzrCommandError("please specify a commit"3328 raise errors.BzrCommandError("please specify a commit"
3329 " message with either --message or --file")3329 " message with either --message or --file")
3330 if my_message == "":3330 if my_message == "":
3331 raise errors.BzrCommandError("Empty commit message specified."3331 raise errors.BzrCommandError("Empty commit message specified."
3332 " Please specify a commit message with either"3332 " Please specify a commit message with either"
3333 " --message or --file or leave a blank message"3333 " --message or --file or leave a blank message"
3334 " with --message \"\".")3334 " with --message \"\".")
3335 return my_message3335 return my_message
33363336
3337 # The API permits a commit with a filter of [] to mean 'select nothing'3337 # The API permits a commit with a filter of [] to mean 'select nothing'
33383338
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- bzrlib/tests/blackbox/test_commit.py 2011-08-13 23:07:36 +0000
+++ bzrlib/tests/blackbox/test_commit.py 2011-08-17 10:58:35 +0000
@@ -29,13 +29,10 @@
29 osutils,29 osutils,
30 ignores,30 ignores,
31 msgeditor,31 msgeditor,
32 tests,
33 )32 )
34from bzrlib.bzrdir import BzrDir33from bzrlib.bzrdir import BzrDir
35from bzrlib.tests import (34from bzrlib.tests import (
36 probe_bad_non_ascii,
37 test_foreign,35 test_foreign,
38 TestSkipped,
39 features,36 features,
40 )37 )
41from bzrlib.tests import TestCaseWithTransport38from bzrlib.tests import TestCaseWithTransport
@@ -332,7 +329,7 @@
332 tree = self.make_branch_and_tree('.')329 tree = self.make_branch_and_tree('.')
333 self.build_tree_contents([('foo.c', 'int main() {}')])330 self.build_tree_contents([('foo.c', 'int main() {}')])
334 tree.add('foo.c')331 tree.add('foo.c')
335 self.run_bzr('commit -m ""', retcode=3)332 self.run_bzr('commit -m ""')
336333
337 def test_other_branch_commit(self):334 def test_other_branch_commit(self):
338 # this branch is to ensure consistent behaviour, whether we're run335 # this branch is to ensure consistent behaviour, whether we're run
@@ -741,6 +738,16 @@
741 tree.add('hello.txt')738 tree.add('hello.txt')
742 return tree739 return tree
743740
741 def test_edit_empty_message(self):
742 tree = self.make_branch_and_tree('tree')
743 self.setup_editor()
744 self.build_tree(['tree/hello.txt'])
745 tree.add('hello.txt')
746 out, err = self.run_bzr("commit tree/hello.txt", retcode=3,
747 stdin="y\n")
748 self.assertContainsRe(err,
749 "bzr: ERROR: Empty commit message specified")
750
744 def test_commit_hook_template_accepted(self):751 def test_commit_hook_template_accepted(self):
745 tree = self.setup_commit_with_template()752 tree = self.setup_commit_with_template()
746 out, err = self.run_bzr("commit tree/hello.txt", stdin="y\n")753 out, err = self.run_bzr("commit tree/hello.txt", stdin="y\n")
747754
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2011-08-17 08:40:16 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2011-08-17 10:58:35 +0000
@@ -81,6 +81,10 @@
81.. Improvements to existing commands, especially improved performance 81.. Improvements to existing commands, especially improved performance
82 or memory usage, or better results.82 or memory usage, or better results.
8383
84* ``bzr commit -m ''`` can now be used to force an empty commit message.
85 Entering an empty commit message in the message editor still triggers
86 an error. (Jelmer Vernooij)
87
84Bug Fixes88Bug Fixes
85*********89*********
8690