From patchwork Wed Apr 8 05:13:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Wu X-Patchwork-Id: 459089 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 4DDF214011D for ; Wed, 8 Apr 2015 15:10:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 59D574B65D; Wed, 8 Apr 2015 07:10:33 +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 x3tzODs-JlyV; Wed, 8 Apr 2015 07:10:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8272EA741C; Wed, 8 Apr 2015 07:10:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1A1CA741C for ; Wed, 8 Apr 2015 07:10:29 +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 3I69modsmozg for ; Wed, 8 Apr 2015 07:10:29 +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.243]) by theia.denx.de (Postfix) with ESMTPS id 660D64B615 for ; Wed, 8 Apr 2015 07:10:25 +0200 (CEST) Received: from apsmtp01.atmel.com (10.168.254.31) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.2.347.0; Wed, 8 Apr 2015 07:10:18 +0200 Received: from melon.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.2.347.0; Wed, 8 Apr 2015 13:10:30 +0800 From: Josh Wu To: Simon Glass Date: Wed, 8 Apr 2015 13:13:00 +0800 Message-ID: <1428469980-12285-1-git-send-email-josh.wu@atmel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: U-Boot Mailing List Subject: [U-Boot] [PATCH] patman: check git format.subjectprefix setting when generate patches prefix 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" For the local project, we may specified format.subjectprefix setting. Then the patch will be formated as [Project_prefix][PATCH]. But patman will not check this setting. It will remove the format.subjectprefix. So This patch will let patman check this setting and add it as a project prefix. Signed-off-by: Josh Wu --- tools/patman/gitutil.py | 11 +++++++++++ tools/patman/series.py | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 4c2c35b..9e739d8 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -545,6 +545,17 @@ def GetDefaultUserEmail(): uemail = command.OutputOneLine('git', 'config', '--global', 'user.email') return uemail +def GetDefaultSubjectPrefix(): + """Gets the format.subjectprefix from local .git/config file. + + Returns: + Subject prefix found in local .git/config file, or None if none + """ + sub_prefix = command.OutputOneLine('git', 'config', 'format.subjectprefix', + raise_on_error=False) + + return sub_prefix + def Setup(): """Set up git utils, by reading the alias files.""" # Check for a git alias file also diff --git a/tools/patman/series.py b/tools/patman/series.py index 60ebc76..a17a7d1 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -254,6 +254,12 @@ class Series(dict): Return: Patch string, like 'RFC PATCH v5' or just 'PATCH' """ + git_prefix = gitutil.GetDefaultSubjectPrefix() + if git_prefix: + git_prefix = '%s][' % git_prefix + else: + git_prefix = '' + version = '' if self.get('version'): version = ' v%s' % self['version'] @@ -262,4 +268,4 @@ class Series(dict): prefix = '' if self.get('prefix'): prefix = '%s ' % self['prefix'] - return '%sPATCH%s' % (prefix, version) + return '%s%sPATCH%s' % (git_prefix, prefix, version)