From patchwork Tue Mar 31 01:54:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Wu X-Patchwork-Id: 456438 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C9EBE1400A0 for ; Tue, 31 Mar 2015 12:51:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4A791A7421; Tue, 31 Mar 2015 03:51:52 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fOOq8ThErDAZ; Tue, 31 Mar 2015 03:51:52 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C3E234B657; Tue, 31 Mar 2015 03:51:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 77BA04B657 for ; Tue, 31 Mar 2015 03:51:48 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4oSsG9upWIP2 for ; Tue, 31 Mar 2015 03:51:48 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from eusmtp01.atmel.com (eusmtp01.atmel.com [212.144.249.242]) by theia.denx.de (Postfix) with ESMTPS id 44DBA4B656 for ; Tue, 31 Mar 2015 03:51:44 +0200 (CEST) Received: from apsmtp01.atmel.com (10.168.254.30) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.347.0; Tue, 31 Mar 2015 03:51:39 +0200 Received: from melon.corp.atmel.com (10.168.254.13) by apsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server id 14.2.347.0; Tue, 31 Mar 2015 09:52:00 +0800 From: Josh Wu To: Simon Glass , U-Boot Mailing List Date: Tue, 31 Mar 2015 09:54:09 +0800 Message-ID: <1427766849-9422-1-git-send-email-josh.wu@atmel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Subject: [U-Boot] [ PATCH] patman: cover letter shows like 00/xx if more than 10 patches X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Make cover letter shows like 0/x, 00/xx and 000/xxx etc. Signed-off-by: Josh Wu --- 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 ***'):