pq: support 'Topic' patch-export command
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Wed, 4 Sep 2013 13:01:17 +0000 (16:01 +0300)
committerGuido Günther <agx@sigxcpu.org>
Thu, 31 Oct 2013 18:17:21 +0000 (19:17 +0100)
Topic can be defined with either 'Gbp: Topic <topic>' or 'Gbp-Pq: Topic
<topic>' in the commit message.

This is to replace the "gbp-pq-topic: <topic>" command.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/scripts/common/pq.py
gbp/scripts/pq.py

index 7f0c0c9..8e41d4a 100644 (file)
@@ -155,12 +155,11 @@ def write_patch_file(filename, commit_info, diff):
 
 
 def format_patch(outdir, repo, commit_info, series, numbered=True,
-                 topic_regex=None, path_exclude_regex=None):
+                 topic_regex=None, path_exclude_regex=None, topic=''):
     """Create patch of a single commit"""
     commit = commit_info['id']
 
     # Parse and filter commit message body
-    topic = ""
     mangled_body = ""
     for line in commit_info['body'].splitlines():
         if topic_regex:
index 1a15f10..8682d85 100755 (executable)
@@ -54,11 +54,12 @@ def generate_patches(repo, start, end, outdir, options):
     topic_regex = 'gbp-pq-topic:\s*(?P<topic>\S.*)'
     for commit in rev_list:
         info = repo.get_commit_info(commit)
-        cmds = parse_gbp_commands(info, 'gbp', ('ignore'), None)
-        cmds.update(parse_gbp_commands(info, 'gbp-pq', ('ignore'), None))
+        cmds = parse_gbp_commands(info, 'gbp', ('ignore'), ('topic'))
+        cmds.update(parse_gbp_commands(info, 'gbp-pq', ('ignore'), ('topic')))
         if not 'ignore' in cmds:
+            topic = cmds['topic'] if 'topic' in cmds else ''
             format_patch(outdir, repo, info, patches, options.patch_numbers,
-                         topic_regex=topic_regex)
+                         topic_regex=topic_regex, topic=topic)
         else:
             gbp.log.info('Ignoring commit %s' % info['id'])