]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
patman: Add Series-process-log tag to sort/uniq change logs
authorSimon Glass <sjg@chromium.org>
Tue, 26 Mar 2013 13:09:44 +0000 (13:09 +0000)
committerSimon Glass <sjg@chromium.org>
Mon, 8 Apr 2013 22:21:22 +0000 (15:21 -0700)
For some series with lots of changes it is annoying that duplicate change
log items are not caught. It is also helpful sometimes to sort the change
logs.

Add a Series-process-log tag to enable this, which can be placed in a
commit to control this.

The change to the Cc: line is to fix a checkpatch warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
tools/patman/README
tools/patman/patchstream.py
tools/patman/series.py

index d4e7f36c3e9cb9b57f036722caa04c652e55e785..8cffcd1f3d53ae010928000a4b1e29d81452ccf3 100644 (file)
@@ -225,9 +225,16 @@ Series-changes: n
        to update the log there and then, knowing that the script will
        do the rest.
 
        to update the log there and then, knowing that the script will
        do the rest.
 
-Cc: Their Name <email>
+ Cc: Their Name <email>
        This copies a single patch to another email address.
 
        This copies a single patch to another email address.
 
+Series-process-log: sort, uniq
+       This tells patman to sort and/or uniq the change logs. It is
+       assumed that each change log entry is only a single line long.
+       Use 'sort' to sort the entries, and 'uniq' to include only
+       unique entries. If omitted, no change log processing is done.
+       Separate each tag with a comma.
+
 Various other tags are silently removed, like these Chrome OS and
 Gerrit tags:
 
 Various other tags are silently removed, like these Chrome OS and
 Gerrit tags:
 
index fc7492e95a84e79540228f0b1cce40d3491e4542..7334ed30e36da32490f2fae2fe943b8f16238081 100644 (file)
@@ -46,7 +46,7 @@ re_cover = re.compile('^Cover-letter:')
 re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
 
 # Patch series tag
 re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')
 
 # Patch series tag
-re_series = re.compile('^Series-(\w*): *(.*)')
+re_series = re.compile('^Series-([a-z-]*): *(.*)')
 
 # Commit tags that we want to collect and keep
 re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Cc): (.*)')
 
 # Commit tags that we want to collect and keep
 re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Cc): (.*)')
index eb5a00c37aff1aa495b6c1e120fe4d4198a8a657..783b3dd1338483ba7e5b7f6d8ddd61ee325f0902 100644 (file)
@@ -28,7 +28,7 @@ import terminal
 
 # Series-xxx tags that we understand
 valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
 
 # Series-xxx tags that we understand
 valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
-                'cover-cc']
+                'cover-cc', 'process_log']
 
 class Series(dict):
     """Holds information about a patch series, including all tags.
 
 class Series(dict):
     """Holds information about a patch series, including all tags.
@@ -167,15 +167,20 @@ class Series(dict):
             etc.
         """
         final = []
             etc.
         """
         final = []
+        process_it = self.get('process_log', '').split(',')
+        process_it = [item.strip() for item in process_it]
         need_blank = False
         for change in sorted(self.changes, reverse=True):
             out = []
             for this_commit, text in self.changes[change]:
                 if commit and this_commit != commit:
                     continue
         need_blank = False
         for change in sorted(self.changes, reverse=True):
             out = []
             for this_commit, text in self.changes[change]:
                 if commit and this_commit != commit:
                     continue
-                out.append(text)
+                if 'uniq' not in process_it or text not in out:
+                    out.append(text)
             line = 'Changes in v%d:' % change
             have_changes = len(out) > 0
             line = 'Changes in v%d:' % change
             have_changes = len(out) > 0
+            if 'sort' in process_it:
+                out = sorted(out)
             if have_changes:
                 out.insert(0, line)
             else:
             if have_changes:
                 out.insert(0, line)
             else: