summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-09 14:43:25 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-09 15:03:41 +0300
commit1c31d897e428416ad9560bd8b9f23edfe2900bc3 (patch)
treeffc6dc1700834c1636f1697f2132a45fd617a1fb
parentc882c43b83f405ab8dd8a165b0e011c55d7417ed (diff)
downloadgit-buildpackage-1c31d897e428416ad9560bd8b9f23edfe2900bc3.tar.gz
git-buildpackage-1c31d897e428416ad9560bd8b9f23edfe2900bc3.tar.bz2
git-buildpackage-1c31d897e428416ad9560bd8b9f23edfe2900bc3.zip
pq: pass commit_info to format_patch()
Eliminate one excess get_commin_info for every patch. Change-Id: Ic209063065966ac7d8e3d1867bfe6d7f121d4c09 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/scripts/common/pq.py14
-rwxr-xr-xgbp/scripts/pq.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index 96bbe928..46058569 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -231,14 +231,14 @@ def write_patch_file(filename, commit_info, diff):
return filename
-def format_patch(outdir, repo, commit, series, numbered=True,
+def format_patch(outdir, repo, commit_info, series, numbered=True,
old_style_topic_cmd=False, path_exclude_regex=None, topic=''):
"""Create patch of a single commit"""
- info = repo.get_commit_info(commit)
+ commit = commit_info['id']
# Parse and filter commit message body
mangled_body = ""
- for line in info['body'].splitlines():
+ for line in commit_info['body'].splitlines():
if old_style_topic_cmd:
topic_regex = 'gbp-pq-topic:\s*(?P<topic>\S.*)'
match = re.match(topic_regex, line, flags=re.I)
@@ -249,14 +249,14 @@ def format_patch(outdir, repo, commit, series, numbered=True,
"please use 'Gbp[-Pq]: Topic <topic>' instead")
continue
mangled_body += line + '\n'
- info['body'] = mangled_body
+ commit_info['body'] = mangled_body
# Determine filename and path
outdir = os.path.join(outdir, topic)
if not os.path.exists(outdir):
os.makedirs(outdir)
filename = '%04d-' % (len(series) + 1) if numbered else ''
- filename += info['patchname']
+ filename += commit_info['patchname']
suffix = ".patch"
filename = filename[:63-len(suffix)]
filepath = os.path.join(outdir, filename) + suffix
@@ -267,13 +267,13 @@ def format_patch(outdir, repo, commit, series, numbered=True,
filepath = os.path.join(outdir, filename) + suffix
# Determine files to include
- paths = patch_path_filter(info['files'], path_exclude_regex)
+ paths = patch_path_filter(commit_info['files'], path_exclude_regex)
# Finally, create the patch
patch = None
if paths:
diff = repo.diff('%s^!' % commit, paths=paths, stat=80, summary=True)
- patch = write_patch_file(filepath, info, diff)
+ patch = write_patch_file(filepath, commit_info, diff)
if patch:
series.append(patch)
return patch
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 0a7553d6..f257f529 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -57,7 +57,7 @@ def generate_patches(repo, start, end, outdir, options):
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, commit, patches, options.patch_numbers,
+ format_patch(outdir, repo, info, patches, options.patch_numbers,
old_style_topic_cmd=True, topic=topic)
else:
gbp.log.info('Ignoring commit %s' % info['id'])