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
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2011-08-17 02:08:00 +0000
3+++ bzrlib/builtins.py 2011-08-17 10:58:35 +0000
4@@ -3327,11 +3327,11 @@
5 if my_message is None:
6 raise errors.BzrCommandError("please specify a commit"
7 " message with either --message or --file")
8- if my_message == "":
9- raise errors.BzrCommandError("Empty commit message specified."
10- " Please specify a commit message with either"
11- " --message or --file or leave a blank message"
12- " with --message \"\".")
13+ if my_message == "":
14+ raise errors.BzrCommandError("Empty commit message specified."
15+ " Please specify a commit message with either"
16+ " --message or --file or leave a blank message"
17+ " with --message \"\".")
18 return my_message
19
20 # The API permits a commit with a filter of [] to mean 'select nothing'
21
22=== modified file 'bzrlib/tests/blackbox/test_commit.py'
23--- bzrlib/tests/blackbox/test_commit.py 2011-08-13 23:07:36 +0000
24+++ bzrlib/tests/blackbox/test_commit.py 2011-08-17 10:58:35 +0000
25@@ -29,13 +29,10 @@
26 osutils,
27 ignores,
28 msgeditor,
29- tests,
30 )
31 from bzrlib.bzrdir import BzrDir
32 from bzrlib.tests import (
33- probe_bad_non_ascii,
34 test_foreign,
35- TestSkipped,
36 features,
37 )
38 from bzrlib.tests import TestCaseWithTransport
39@@ -332,7 +329,7 @@
40 tree = self.make_branch_and_tree('.')
41 self.build_tree_contents([('foo.c', 'int main() {}')])
42 tree.add('foo.c')
43- self.run_bzr('commit -m ""', retcode=3)
44+ self.run_bzr('commit -m ""')
45
46 def test_other_branch_commit(self):
47 # this branch is to ensure consistent behaviour, whether we're run
48@@ -741,6 +738,16 @@
49 tree.add('hello.txt')
50 return tree
51
52+ def test_edit_empty_message(self):
53+ tree = self.make_branch_and_tree('tree')
54+ self.setup_editor()
55+ self.build_tree(['tree/hello.txt'])
56+ tree.add('hello.txt')
57+ out, err = self.run_bzr("commit tree/hello.txt", retcode=3,
58+ stdin="y\n")
59+ self.assertContainsRe(err,
60+ "bzr: ERROR: Empty commit message specified")
61+
62 def test_commit_hook_template_accepted(self):
63 tree = self.setup_commit_with_template()
64 out, err = self.run_bzr("commit tree/hello.txt", stdin="y\n")
65
66=== modified file 'doc/en/release-notes/bzr-2.5.txt'
67--- doc/en/release-notes/bzr-2.5.txt 2011-08-17 08:40:16 +0000
68+++ doc/en/release-notes/bzr-2.5.txt 2011-08-17 10:58:35 +0000
69@@ -81,6 +81,10 @@
70 .. Improvements to existing commands, especially improved performance
71 or memory usage, or better results.
72
73+* ``bzr commit -m ''`` can now be used to force an empty commit message.
74+ Entering an empty commit message in the message editor still triggers
75+ an error. (Jelmer Vernooij)
76+
77 Bug Fixes
78 *********
79