public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [ PATCH] patman: cover letter shows like 00/xx if more than 10 patches
@ 2015-03-31  1:54 Josh Wu
  2015-04-01  2:04 ` Simon Glass
  0 siblings, 1 reply; 8+ messages in thread
From: Josh Wu @ 2015-03-31  1:54 UTC (permalink / raw)
  To: u-boot

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 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
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-08  2:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31  1:54 [U-Boot] [ PATCH] patman: cover letter shows like 00/xx if more than 10 patches Josh Wu
2015-04-01  2:04 ` Simon Glass
2015-04-01  2:54   ` Josh Wu
2015-04-05 18:31     ` Simon Glass
2015-04-07  2:31       ` Josh Wu
2015-04-07 20:49         ` Simon Glass
2015-04-08  2:38           ` Josh Wu
2015-04-08  2:41             ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox