Merge lp:~paulbrianstewart/bzr/207507-bzr-commit-message into lp:bzr
- 207507-bzr-commit-message
- Merge into bzr.dev
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Jelmer Vernooij | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 6069 | ||||||||
Proposed branch: | lp:~paulbrianstewart/bzr/207507-bzr-commit-message | ||||||||
Merge into: | lp:bzr | ||||||||
Diff against target: |
30 lines (+8/-2) 2 files modified
bzrlib/builtins.py (+4/-1) bzrlib/tests/blackbox/test_commit.py (+4/-1) |
||||||||
To merge this branch: | bzr merge lp:~paulbrianstewart/bzr/207507-bzr-commit-message | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | Approve | ||
Paul Stewart (community) | Needs Resubmitting | ||
Review via email: mp+68921@code.launchpad.net |
Commit message
Mention ways of specifying a commit message or forcing an empty commit message when the user specifies an empty message.
Description of the change
In file bzr.bzrlib.
if my_message == "":
raise errors.
In file bzr.bzrlib.
out, err = self.run_
" Please specify a commit message with either"
" --message or --file or leave a blank message"
" with --message '' "],
"commit tree/hello.txt", stdin="n\n")
This is a possible fix for bug #207507
Paul Stewart (paulbrianstewart) wrote : | # |
Thanks Jelmer,
I'll look back over it and try to do the tests you suggest.
Thanks for your guidance and help.
Paul
> Hi Paul,
>
> Thanks for working on these papercut bugs.
>
> We have a policy in Bazaar to not use more than 80 characters per line, can
> you split the message up over multiple lines? The exception that's raised a
> couple of lines above is a good example.
>
> The quotes around the -m look a bit odd, and are inconsistent with the way we
> mention options in other places. Perhaps it would also be useful to spell out
> type long option name and mention --file as an alternative to --message.
>
> Have you tried running the test suite with these changes (./bzr selftest --no-
> plugins)? There might be a few tests that rely on the previous message.
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer
I have been working away on understanding how to both change the commit error text, and also run the ./bzr selftest --no-plugins command on the my updated code. I noticed at first that there were 110 failed tests, so I went back to the original code, and changed just one thing, that being I changed the word 'empty' to 'Empty'. When I reran the code I got one failed test, in the ...bzr/
I have pasted part of the message below.
Does this mean that when I change the message in the builtins.py file I also need to change it in the tests file as well? I'm just trying to figure out what I need to do to move forward. I am assuming that the idea is to modify/fix code until you get 0 failed tests?
Thanks for your help.
Paul
43.787 Traceback (most recent call last):
File "/home/
return run_bzr(argv)
File "/home/
ret = run(*run_argv)
File "/home/
return self.run(
File "/home/
return self._operation
File "/home/
self.cleanups, self.func, *args, **kwargs)
File "/home/
result = func(*args, **kwargs)
File "/home/
lossy=lossy)
File "/home/
result = unbound(self, *args, **kwargs)
File "/home/
result = WorkingTree.
File "/home/
result = unbound(self, *args, **kwargs)
File "/home/
*args, **kwargs)
File "/home/
lossy=lossy)
File "/home/
self.cleanups, self.func, self, *args, **kwargs)
File "/home/
result = func(*args, **kwargs)
File "/home/
message = message_
File "/home/
raise errors.
BzrCommandError: Empty commit message specified
43.787 errors:
'Committing to: /tmp/testbzr-
------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/usr/lib/
return fn(*args, **kwargs)
File "/usr/lib/
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
On Mon, 2011-07-25 at 23:14 +0000, Paul Stewart wrote:
> I have been working away on understanding how to both change the commit error text, and also run the ./bzr selftest --no-plugins command on the my updated code. I noticed at first that there were 110 failed tests, so I went back to the original code, and changed just one thing, that being I changed the word 'empty' to 'Empty'. When I reran the code I got one failed test, in the ...bzr/
> I have pasted part of the message below.
> Does this mean that when I change the message in the builtins.py file I also need to change it in the tests file as well? I'm just trying to figure out what I need to do to move forward. I am assuming that the idea is to modify/fix code until you get 0 failed tests?
Yes, if you change the code you will also need to modify the tests to
reflect that the expected behaviour has changed.
If you follow test driven development, you could also modify the test
first. The test is making sure that Bazaar is doing the right thing, so
if you update the test first, you can then keep running the tests and
updating the code until all the tests pass.
Does that help?
Cheers,
Jelmer
>
> Thanks for your help.
> Paul
>
> 43.787 Traceback (most recent call last):
> File "/home/
> return run_bzr(argv)
> File "/home/
> ret = run(*run_argv)
> File "/home/
> return self.run(
> File "/home/
> return self._operation
> File "/home/
> self.cleanups, self.func, *args, **kwargs)
> File "/home/
> result = func(*args, **kwargs)
> File "/home/
> lossy=lossy)
> File "/home/
> result = unbound(self, *args, **kwargs)
> File "/home/
> result = WorkingTree.
> File "/home/
> result = unbound(self, *args, **kwargs)
> File "/home/
> *args, **kwargs)
> File "/home/
> lossy=lossy)
> File "/home/
> self.cleanups, self.func, self, *args, **kwargs)
> File "/home/
> result = func(*args, **kwargs)
> File "/home/
> message = message_
> File "/home/
> raise errors.
> BzrCommandError: Empty commit message spec...
Paul Stewart (paulbrianstewart) wrote : | # |
Thanks Jelmer,
That answers my question exactly. I have changed the code to the expected behavior in the test file and now don't get any errors, so I will keep working away at this and then push it back up and request another review.
Thanks for your help
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
I have updated and formatted the empty commit message text in the bzrlib.builtins.py and bzrlib.
When you have time could you please review it and let me know if there is anything else I need to do.
Thanks for your time.
Paul Stewart
Jelmer Vernooij (jelmer) wrote : | # |
Cool, this looks alright to me.
Can't the message be '' rather than ' ' ?
Paul Stewart (paulbrianstewart) wrote : | # |
> Cool, this looks alright to me.
>
> Can't the message be '' rather than ' ' ?
My bad...let me fix that...
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
I have changed the --message ' ' to --message '' as you suggested.
Let me know if you need me to do anything else.
Thanks
Paul Stewart
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
Let me know if there is anything else I need to do for this.
Thanks for your time.
Paul Stewart
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
The change seems reasonable, but the recommended usage ("Specify --message ''") does not seem to work. E.g.:
$ bzr ci --message ""
Committing to: /tmp/t/
bzr: ERROR: empty commit message specified
I think we need to fix "bzr commit" to allow empty commit messages (perhaps only when specified on the command-line, not from the file editor).
Jelmer Vernooij (jelmer) wrote : | # |
It would be nice to land your changes though; if you don't have time to look at adding support for "bzr commit -m ''", I could have a look at it next week.
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
Thanks for working on this....I'll have a look, but am not sure if I have the know-how to fix the part that allows the bzr commit to let empty messages...either way I'll take a look and see what i can do. If you haven't heard from me by next week please feel free to have a look at it yourself. I mistakenly thought that if the self tests passed then it must have been working...still learning :)
THanks for your help.
Paul
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
On Sun, 2011-07-31 at 00:02 +0000, Paul Stewart wrote:
> Thanks for working on this....I'll have a look, but am not sure if I
> have the know-how to fix the part that allows the bzr commit to let
> empty messages...either way I'll take a look and see what i can do. If
> you haven't heard from me by next week please feel free to have a look
> at it yourself. I mistakenly thought that if the self tests passed then
> it must have been working...still learning :)
Unfortunately our test suite is not yet capable of interpreting and
executing full English sentences. I wish it was. ;-)
Cheers,
Jelmer
Paul Stewart (paulbrianstewart) wrote : | # |
> Hi Paul,
>
> On Sun, 2011-07-31 at 00:02 +0000, Paul Stewart wrote:
> > Thanks for working on this....I'll have a look, but am not sure if I
> > have the know-how to fix the part that allows the bzr commit to let
> > empty messages...either way I'll take a look and see what i can do. If
> > you haven't heard from me by next week please feel free to have a look
> > at it yourself. I mistakenly thought that if the self tests passed then
> > it must have been working...still learning :)
> Unfortunately our test suite is not yet capable of interpreting and
> executing full English sentences. I wish it was. ;-)
>
> Cheers,
>
> Jelmer
Cheers Jelmer....I guess that was a bit of ambitious to wish for aye :)
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
I have some month end reporting to do right now, so won't be able to look at it for another couple of days, so if someone else wants to fix it please go ahead...I'll look at it again as soon as I have cleared up my schedule.
Thanks
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
If I changed the code to what I originally had, which was --message ' ' (with the space), wouldn't that eliminate the problem/need to make bzr allow empty bzr commit messages? The space would technically make the message not empty? I don't know if that is good form, but just a thought?
What do you think?
Thanks
Paul Stewart
John A Meinel (jameinel) wrote : | # |
On 8/4/2011 4:51 AM, Paul Stewart wrote:
> Hi Jelmer,
>
> If I changed the code to what I originally had, which was --message '
> ' (with the space), wouldn't that eliminate the problem/need to make
> bzr allow empty bzr commit messages? The space would technically make
> the message not empty? I don't know if that is good form, but just a
> thought?
>
> What do you think?
>
> Thanks Paul Stewart
>
Yes, 'bzr commit -m " "' should work today because we get a blank space
and not an empty commit message.
I'm pretty sure we had reason to not default to allowing empty messages,
(it *really* is hard to understand history with them), however, if
people feel strongly we can be more flexible.
Basically, I think our position should be that the user should
explicitly request a blank message, and 'bzr commit -m ""' seems to
cover that.
I would definitely make the warning message use "" and not '' because ''
doesn't work on Windows.
John
=:->
Jelmer Vernooij (jelmer) wrote : | # |
On Fri, 2011-08-05 at 10:01 +0000, John A Meinel wrote:
> On 8/4/2011 4:51 AM, Paul Stewart wrote:
> > Hi Jelmer,
> >
> > If I changed the code to what I originally had, which was --message '
> > ' (with the space), wouldn't that eliminate the problem/need to make
> > bzr allow empty bzr commit messages? The space would technically make
> > the message not empty? I don't know if that is good form, but just a
> > thought?
> >
> > What do you think?
> Yes, 'bzr commit -m " "' should work today because we get a blank space
> and not an empty commit message.
>
> I'm pretty sure we had reason to not default to allowing empty messages,
> (it *really* is hard to understand history with them), however, if
> people feel strongly we can be more flexible.
I think this was my first bazaar code patch. :) It's especially useful
if you don't use -m but bzr puts you into an editor to type the commit
message. Quitting the editor without saving is a good way of aborting
the commit.
-m "" indeed seems like a good way of saying "no, I really want to
commit with a empty commit message".
Cheers,
Jelmer
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
I have updated the message to use the double quotes "" rather than the single quotes '' so it works in Windows. Please check it out as you have time.
Thanks
Paul Stewart
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
On 06/08/11 00:32, Paul Stewart wrote:
> Review: Resubmit
> Hi Jelmer,
>
> I have updated the message to use the double quotes "" rather than the single quotes '' so it works in Windows. Please check it out as you have time.
>
Thanks for the update. This looks good, though we'll still need to fix
bzr to accept '-m ""' without complaining.
Cheers,
Jelmer
Paul Stewart (paulbrianstewart) wrote : | # |
> Hi Paul,
>
> On 06/08/11 00:32, Paul Stewart wrote:
> > Review: Resubmit
> > Hi Jelmer,
> >
> > I have updated the message to use the double quotes "" rather than the
> single quotes '' so it works in Windows. Please check it out as you have time.
> >
> Thanks for the update. This looks good, though we'll still need to fix
> bzr to accept '-m ""' without complaining.
>
> Cheers,
>
> Jelmer
Yes, I forgot that point..
I'll see if I can find it and do it.
Thanks
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
> Hi Paul,
>
> On 06/08/11 00:32, Paul Stewart wrote:
> > Review: Resubmit
> > Hi Jelmer,
> >
> > I have updated the message to use the double quotes "" rather than the
> single quotes '' so it works in Windows. Please check it out as you have time.
> >
> Thanks for the update. This looks good, though we'll still need to fix
> bzr to accept '-m ""' without complaining.
>
> Cheers,
>
> Jelmer
Yes, I forgot that point..
I'll see if I can find it and do it.
Thanks
Paul
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
On 04/08/11 04:51, Paul Stewart wrote:
> Hi Jelmer,
>
> If I changed the code to what I originally had, which was --message ' ' (with the space), wouldn't that eliminate the problem/need to make bzr allow empty bzr commit messages? The space would technically make the message not empty? I don't know if that is good form, but just a thought?
I've just submitted a branch that makes Bazaar accept empty commit
messages if explicitly specified. Once that lands I think we could land
your branch.
See https:/
Cheers,
Jelmer
Paul Stewart (paulbrianstewart) wrote : | # |
> Hi Paul,
>
> On 04/08/11 04:51, Paul Stewart wrote:
> > Hi Jelmer,
> >
> > If I changed the code to what I originally had, which was --message ' '
> (with the space), wouldn't that eliminate the problem/need to make bzr allow
> empty bzr commit messages? The space would technically make the message not
> empty? I don't know if that is good form, but just a thought?
> I've just submitted a branch that makes Bazaar accept empty commit
> messages if explicitly specified. Once that lands I think we could land
> your branch.
>
> See https:/
>
> Cheers,
>
> Jelmer
Excellent!..thanks Jelmer.
So do you need me to do anything els at this stage?
Thanks
Paul Stewart
Jelmer Vernooij (jelmer) wrote : | # |
Hi Paul,
No, let's have a look at landing it :)
Jelmer Vernooij (jelmer) wrote : | # |
Actually, one more question - can you add punctuation to the error message?
Thanks for your patience with this MP, and for working on it. :)
Paul Stewart (paulbrianstewart) wrote : | # |
> Actually, one more question - can you add punctuation to the error message?
>
> Thanks for your patience with this MP, and for working on it. :)
Sure, I can do that....I'll work on that sometime today....
THanks for your patience too.
Paul
Paul Stewart (paulbrianstewart) wrote : | # |
Hi Jelmer,
I have added punctuation to the message as requested.
Thanks
Paul Stewart
Jelmer Vernooij (jelmer) : | # |
Jelmer Vernooij (jelmer) wrote : | # |
sent to pqm by email
Jelmer Vernooij (jelmer) wrote : | # |
On 14/08/11 01:13, Paul Stewart wrote:
> Review: Resubmit
> Hi Jelmer,
>
> I have added punctuation to the message as requested.
>
Thanks, I've submitted your branch to PQM.
Cheers,
Jelmer
Paul Stewart (paulbrianstewart) wrote : | # |
Jelmer,
Thanks. Let me know if you need me to do anything else.
Cheers
Paul Stewart
Preview Diff
1 | === modified file 'bzrlib/builtins.py' |
2 | --- bzrlib/builtins.py 2011-07-21 07:08:05 +0000 |
3 | +++ bzrlib/builtins.py 2011-08-13 23:09:27 +0000 |
4 | @@ -3328,7 +3328,10 @@ |
5 | raise errors.BzrCommandError("please specify a commit" |
6 | " message with either --message or --file") |
7 | if my_message == "": |
8 | - raise errors.BzrCommandError("empty commit message specified") |
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 | return my_message |
14 | |
15 | # The API permits a commit with a filter of [] to mean 'select nothing' |
16 | |
17 | === modified file 'bzrlib/tests/blackbox/test_commit.py' |
18 | --- bzrlib/tests/blackbox/test_commit.py 2011-06-14 01:26:41 +0000 |
19 | +++ bzrlib/tests/blackbox/test_commit.py 2011-08-13 23:09:27 +0000 |
20 | @@ -750,7 +750,10 @@ |
21 | def test_commit_hook_template_rejected(self): |
22 | tree = self.setup_commit_with_template() |
23 | expected = tree.last_revision() |
24 | - out, err = self.run_bzr_error(["empty commit message"], |
25 | + out, err = self.run_bzr_error(["Empty commit message specified." |
26 | + " Please specify a commit message with either" |
27 | + " --message or --file or leave a blank message" |
28 | + " with --message \"\"."], |
29 | "commit tree/hello.txt", stdin="n\n") |
30 | self.assertEqual(expected, tree.last_revision()) |
31 |
Hi Paul,
Thanks for working on these papercut bugs.
We have a policy in Bazaar to not use more than 80 characters per line, can you split the message up over multiple lines? The exception that's raised a couple of lines above is a good example.
The quotes around the -m look a bit odd, and are inconsistent with the way we mention options in other places. Perhaps it would also be useful to spell out type long option name and mention --file as an alternative to --message.
Have you tried running the test suite with these changes (./bzr selftest --no-plugins)? There might be a few tests that rely on the previous message.