[PATCH] Use the first line of commit message in "log --line"

Robert Collins robertc at robertcollins.net
Tue May 30 01:07:35 BST 2006


On Tue, 2006-05-30 at 09:56 +1000, Michael Ellerman wrote:
> On 5/30/06, Robert Collins <robertc at robertcollins.net> wrote:
> >
> > firstline seems a little overcomplicated. A simpler version:
> > def firstline(self, string):
> > # using a type name as a variable name is frowned upon which is why we
> > # use string, not str
> >     return "".join(string.splitlines()[:1])
> 
> return string.splitlines()[0]  ?
> 
> cheers
> 

>>> "".splitlines()[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IndexError: list index out of range


While the message should always have content, its less safe ;)

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060530/25fc0741/attachment.pgp 


More information about the bazaar mailing list