]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
patman: check git format.subjectprefix setting when generate patches prefix
authorWu, Josh <Josh.wu@atmel.com>
Wed, 15 Apr 2015 02:25:18 +0000 (10:25 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:31:11 +0000 (22:31 +0200)
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 <josh.wu@atmel.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
tools/patman/README
tools/patman/gitutil.py
tools/patman/series.py

index 7d039e82bc2781bc6624bb423f5d8f4ef302232d..27ec90acc80f08bbd0c514a9dccd4cb4fea40d6a 100644 (file)
@@ -154,7 +154,11 @@ Series-version: n
 
 Series-prefix: prefix
        Sets the subject prefix. Normally empty but it can be RFC for
-       RFC patches, or RESEND if you are being ignored.
+       RFC patches, or RESEND if you are being ignored. The patch subject
+       is like [RFC PATCH] or [RESEND PATCH].
+       In the meantime, git format.subjectprefix option will be added as
+       well. If your format.subjectprefix is set to InternalProject, then
+       the patch shows like: [InternalProject][RFC/RESEND PATCH]
 
 Series-name: name
        Sets the name of the series. You don't need to have a name, and
index 4c2c35bf9acfdc44af538cae6ffd64b609018ce9..9e739d89b6ff7ac261d6bc96b6c66def4b7d2937 100644 (file)
@@ -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
index 60ebc766f7e956f959e6577c833ec9c68dc5d848..a17a7d1de7b1a69bd5257cbbc004a84b149c0ca5 100644 (file)
@@ -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)