stringutil: try to avoid running `splitlines()` only to get first line
It's wasteful to call `splitlines()` and only get the first line from
it. However, Python doesn't seem to provide a built-in way of doing
just one split based on the set of bytes used by `splitlines()`. As a
workaround, we do an initial split on just LF and then call
`splitlines()` on the result. Thanks to Joerg for this suggestion. I
didn't bother to also split on CR, so users with old Mac editors (or
repos created by such editors) will not get this performance
improvement.
Differential Revision: https://phab.mercurial-scm.org/D12413
logcmdutil: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12412
filemerge: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12411
absorb: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12410
extensions: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12409
bookmarks: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12408
help: use new function for getting first line of string
Differential Revision: https://phab.mercurial-scm.org/D12407
histedit: remove an unnecessary default value of `b''` for commit message
I don't think `ctx.description()` is ever anything falsy other than
`b''`. I think the comment added in
4c4232e51167 (histedit: extract
common summary code into method, 2016-05-27) is mistaken (I don't see
any code following that pattern before the function was added).
Differential Revision: https://phab.mercurial-scm.org/D12406
histedit: use new function for getting first line of a string
This fixes a crash you can run into if you enter a commit message
that's just a "newline-like" byte, like a form feed byte (`hg ci -m
\x0f` in Fish). That bug is the motivation for this series.
Differential Revision: https://phab.mercurial-scm.org/D12405
templates: extract function to `stringutil` for getting first line of text
It's surprisingly hard to get the first line from a string, so let's
have our own function in `stringutil` for it.
Differential Revision: https://phab.mercurial-scm.org/D12404