[U-Boot] [ PATCH] patman: cover letter shows like 00/xx if more than 10 patches
Simon Glass
sjg at chromium.org
Wed Apr 1 04:04:21 CEST 2015
Hi Josh,
On 30 March 2015 at 19:54, Josh Wu <josh.wu at atmel.com> wrote:
> Make cover letter shows like 0/x, 00/xx and 000/xxx etc.
>
> Signed-off-by: Josh Wu <josh.wu at atmel.com>
> ---
This is a quirk of patman that I've grown comfortable with. Still, we
should fix it. Thanks for the patch.
>
> tools/patman/patchstream.py | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
> index 8c3a0ec..4bfb1e9 100644
> --- a/tools/patman/patchstream.py
> +++ b/tools/patman/patchstream.py
> @@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
> prefix = series.GetPatchPrefix()
> for line in lines:
> if line.startswith('Subject:'):
> - # TODO: if more than 10 patches this should save 00/xx, not 0/xx
> - line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
> + # if more than 10 patches this should save 00/xx, not 0/xx
s/save/say/
(my typo, I think)
> + zero_repeat = 1
> + while (count / (10 ** zero_repeat) > 0):
> + zero_repeat = zero_repeat + 1
How about:
zero_repeat = int(math.log10(count)) + 1
?
> +
> + zero = '0' * zero_repeat
> + line = 'Subject: [%s %s/%d] %s\n' % (prefix, zero, count, text[0])
>
> # Insert our cover letter
> elif line.startswith('*** BLURB HERE ***'):
> --
> 1.9.1
Regards,
Simon
More information about the U-Boot
mailing list