aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-04 16:16:59 +0300
committerGuido Günther <agx@sigxcpu.org>2015-01-25 15:04:13 +0100
commit7ce15d2434ee42aa5a1afce3d03069c5efb2db1b (patch)
tree6f63d4d6089a7052fb321bb49d02066ac198634d
parent644c97f37ce91d464988eddc5f60624a06ff8e73 (diff)
pq: deprecate the usage of 'gbp-pq-topic:'
Replaced by the "Gbp[-Pq]: Topic <topic>" command. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/scripts/common/pq.py19
-rwxr-xr-xgbp/scripts/pq.py28
2 files changed, 28 insertions, 19 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index 459afb9b..04bb7122 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -155,21 +155,8 @@ 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=''):
+ path_exclude_regex=None, topic=''):
"""Create patch of a single commit"""
- commit = commit_info['id']
-
- # Parse and filter commit message body
- mangled_body = ""
- for line in commit_info['body'].splitlines():
- if topic_regex:
- match = re.match(topic_regex, line, flags=re.I)
- if match:
- topic = match.group('topic')
- gbp.log.debug("Topic %s found for %s" % (topic, commit))
- continue
- mangled_body += line + '\n'
- commit_info['body'] = mangled_body
# Determine filename and path
outdir = os.path.join(outdir, topic)
@@ -194,8 +181,8 @@ def format_patch(outdir, repo, commit_info, series, numbered=True,
# Finally, create the patch
patch = None
if paths:
- diff = repo.diff('%s^!' % commit, paths=paths, stat=80, summary=True,
- text=True)
+ diff = repo.diff('%s^!' % commit_info['id'], paths=paths, stat=80,
+ summary=True, text=True)
patch = write_patch_file(filepath, commit_info, diff)
if patch:
series.append(patch)
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index c32a36f4..543907b6 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -41,6 +41,27 @@ PATCH_DIR = "debian/patches/"
SERIES_FILE = os.path.join(PATCH_DIR,"series")
+def parse_old_style_topic(commit_info):
+ """Parse 'gbp-pq-topic:' line(s) from commit info"""
+
+ commit = commit_info['id']
+ topic_regex = 'gbp-pq-topic:\s*(?P<topic>\S.*)'
+ mangled_body = ''
+ topic = ''
+ # Parse and filter commit message body
+ for line in commit_info['body'].splitlines():
+ match = re.match(topic_regex, line, flags=re.I)
+ if match:
+ topic = match.group('topic')
+ gbp.log.debug("Topic %s found for %s" % (topic, commit))
+ gbp.log.warn("Deprecated 'gbp-pq-topic: <topic>' in %s, please "
+ "use 'Gbp[-Pq]: Topic <topic>' instead" % commit)
+ continue
+ mangled_body += line + '\n'
+ commit_info['body'] = mangled_body
+ return topic
+
+
def generate_patches(repo, start, end, outdir, options):
"""
Generate patch files from git
@@ -53,15 +74,16 @@ def generate_patches(repo, start, end, outdir, options):
# Generate patches
rev_list = reversed(repo.get_commits(start, end))
- topic_regex = 'gbp-pq-topic:\s*(?P<topic>\S.*)'
for commit in rev_list:
info = repo.get_commit_info(commit)
+ topic = parse_old_style_topic(info)
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 ''
+ if 'topic' in cmds:
+ topic = cmds['topic']
format_patch(outdir, repo, info, patches, options.patch_numbers,
- topic_regex=topic_regex, topic=topic)
+ topic=topic)
else:
gbp.log.info('Ignoring commit %s' % info['id'])