Rev 4870: commit warns for file-name-like messages in http://bazaar.launchpad.net/~vila/bzr/integration2
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Dec 7 10:38:30 GMT 2009
At http://bazaar.launchpad.net/~vila/bzr/integration2
------------------------------------------------------------
revno: 4870 [merge]
revision-id: v.ladeuil+lp at free.fr-20091207103809-63ocky0xx7nudbnb
parent: pqm at pqm.ubuntu.com-20091207025958-wrddjbe59f5mjgva
parent: v.ladeuil+lp at free.fr-20091207103339-ph3ew9c2c0g3er8v
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration2
timestamp: Mon 2009-12-07 11:38:09 +0100
message:
commit warns for file-name-like messages
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-12-07 02:59:58 +0000
+++ b/NEWS 2009-12-07 10:38:09 +0000
@@ -40,6 +40,10 @@
``source\\path`` rather than ``source/path`` on Windows. This might be a
source of some dirstate-related failures. (John Arbash Meinel)
+* ``bzr commit`` now detects commit messages that looks like file names
+ and issues a warning.
+ (Gioele Barabucci, #73073)
+
* ``bzr ignore /`` no longer causes an IndexError. (Gorder Tyler, #456036)
* ``bzr log -n0 -rN`` should not return revisions beyond its merged revisions.
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-12-07 02:59:58 +0000
+++ b/bzrlib/builtins.py 2009-12-07 10:38:09 +0000
@@ -3066,6 +3066,14 @@
if local and not tree.branch.get_bound_location():
raise errors.LocalRequiresBoundBranch()
+ if message is not None:
+ if osutils.lexists(message):
+ warning_msg = ("The commit message is a file"
+ " name: \"%(filename)s\".\n"
+ "(use --file \"%(filename)s\" to take commit message from"
+ " that file)" % { 'filename': message })
+ ui.ui_factory.show_warning(warning_msg)
+
def get_message(commit_obj):
"""Callback to get commit message"""
my_message = message
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py 2009-11-19 06:28:13 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py 2009-12-07 10:38:09 +0000
@@ -107,6 +107,14 @@
'modified hello\.txt\n'
'Committed revision 2\.\n$')
+ def test_warn_about_forgotten_commit_message(self):
+ """Test that the lack of -m parameter is caught"""
+ wt = self.make_branch_and_tree('.')
+ self.build_tree(['one', 'two'])
+ wt.add(['two'])
+ out, err = self.run_bzr('commit -m one two')
+ self.assertContainsRe(err, "The commit message is a file name")
+
def test_verbose_commit_renamed(self):
# Verbose commit of renamed file should say so
wt = self.prepare_simple_history()
More information about the bazaar-commits
mailing list