[PATCH] Use the first line of commit message in "log --line"
John Arbash Meinel
john at arbash-meinel.com
Tue Jun 6 11:12:59 BST 2006
Matthieu Moy wrote:
> My --line patch doesn't seem to have been merged yet, so here's a
> reminder (I believe I've fixed/removed all the parts on which people
> didn't agree). Additionnaly, I've added an entry in the NEWS file.
>
After discussion, we understand that changing the semantics breaks
things that have already been done slightly, but in the future it is
preferable, so you have to break at some point. Better earlier rather
than later. So I'll be merging the change.
There are a couple small fixes, which I'll just go ahead and fix up, but
I'll make some comments about them so you know in the future.
> Thanks,
>
> === modified file 'NEWS'
> --- NEWS
> +++ NEWS
> @@ -38,7 +38,9 @@
> ftp support has been improved, including support for supplying a
> non-standard port. (John Arbash Meinel).
>
> - * ``log --line`` shows the revision number. (#5162, Alexander Belchenko)
> + * 'bzr log --line' shows the revision number, and uses only the
> + first line of the log message (#5162, Alexander Belchenko;
> + Matthieu Moy)
>
> BUG FIXES:
>
>
> === modified file 'bzrlib/log.py'
> --- bzrlib/log.py
> +++ bzrlib/log.py
> @@ -461,7 +461,7 @@
> out.append("%d:" % revno)
> out.append(self.truncate(self.short_committer(rev), 20))
> out.append(self.date_string(rev))
> - out.append(self.message(rev).replace('\n', ' '))
> + out.append(rev.get_summary())
> return self.truncate(" ".join(out).rstrip('\n'), max_chars)
>
>
>
> === modified file 'bzrlib/revision.py'
> --- bzrlib/revision.py
> +++ bzrlib/revision.py
> @@ -101,6 +101,11 @@
> reversed_result.reverse()
> return reversed_result
>
> + def get_summary(self):
> + """Get the first line of the log message for this revision.
> + """
> + return self.message.split('\n', 1)[0]
> +
>
If you only have one line of comment, then the closing """ should be on
the same line.
def get_summary(self):
"""Get the first line of the log message for this revision."""
> def is_ancestor(revision_id, candidate_id, branch):
> """Return true if candidate_id is an ancestor of revision_id.
>
> === modified file 'bzrlib/tests/blackbox/test_too_much.py'
> --- bzrlib/tests/blackbox/test_too_much.py
> +++ bzrlib/tests/blackbox/test_too_much.py
> @@ -823,7 +823,8 @@
> max_width = terminal_width() - 1
> for line in log_out.splitlines():
> self.assert_(len(line) <= max_width, len(line))
> - self.assert_("this is my new commit and" in log_out)
> + self.assert_("this is my new commit and" not in log_out)
> + self.assert_("this is my new commit" in log_out)
>
> progress("file with spaces in name")
> mkdir('sub directory')
>
Otherwise it looks good. You should see it show up soon.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060606/f6ef1d4e/attachment.pgp
More information about the bazaar
mailing list