summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWu, Josh <Josh.wu@atmel.com>2015-04-03 10:51:17 +0800
committerSimon Glass <sjg@chromium.org>2015-04-18 16:24:25 -0600
commit35ce2dc4d1148b66ce9271d15879dbfec5dd57f4 (patch)
treeece265e840cbde7ac4df1b0084ea488dd5ab5188 /tools
parentf5e5ece0b72ef54cfe4ebdb06e2258a7b3d0228e (diff)
downloadu-boot-imx-35ce2dc4d1148b66ce9271d15879dbfec5dd57f4.zip
u-boot-imx-35ce2dc4d1148b66ce9271d15879dbfec5dd57f4.tar.gz
u-boot-imx-35ce2dc4d1148b66ce9271d15879dbfec5dd57f4.tar.bz2
patman: cover letter shows like 00/xx if more than 10 patches
Make cover letter shows like 0/x, 00/xx and 000/xxx etc. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/patman/patchstream.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 8c3a0ec..6d3c41f 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-2.0+
#
+import math
import os
import re
import shutil
@@ -468,8 +469,10 @@ 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 or 100 patches, it should say 00/xx, 000/xxx, etc
+ 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 ***'):