[PATCH] (updated) Use the first line of commit message in "log --line"
Matthieu Moy
Matthieu.Moy at imag.fr
Wed May 31 08:50:54 BST 2006
Here's the updated patch.
Regarding the "\n" escaping, my current decision is that it's not
worth the trouble. -m is very handy for one-line summary, but the
shell's multi-line edition or a real text editor is probably much
better for multi-line messages anyway.
I think it's ready for merging. We can consider adding a -s, --summary
option later if people ask for it.
--
Matthieu
=== 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 ''.join(self.message.split('\n', 1)[:1])
+
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
@@ -831,7 +831,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')
More information about the bazaar
mailing list