summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'gbp')
-rw-r--r--gbp/scripts/common/pq.py23
-rwxr-xr-xgbp/scripts/pq.py13
2 files changed, 32 insertions, 4 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index 050e7df8..b6b2118d 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -68,6 +68,29 @@ def pq_branch_base(pq_branch):
return pq_branch[len(PQ_BRANCH_PREFIX):]
+def parse_gbp_commands(info, cmd_tag, noarg_cmds, arg_cmds):
+ """Parse gbp commands from commit message"""
+ cmd_re = re.compile(r'^%s:\s*(?P<cmd>[a-z-]+)(\s+(?P<args>\S.*))?' %
+ cmd_tag, flags=re.I)
+ commands = {}
+ for line in info['body'].splitlines():
+ match = re.match(cmd_re, line)
+ if match:
+ cmd = match.group('cmd').lower()
+ if arg_cmds and cmd in arg_cmds:
+ if match.group('args'):
+ commands[cmd] = match.group('args')
+ else:
+ gbp.log.warn("Ignoring gbp-command '%s' in commit %s: "
+ "missing cmd arguments" % (line, info['id']))
+ elif noarg_cmds and cmd in noarg_cmds:
+ commands[cmd] = match.group('args')
+ else:
+ gbp.log.warn("Ignoring unknow gbp-command '%s' in commit %s"
+ % (line, info['id']))
+ return commands
+
+
def patch_path_filter(file_status, exclude_regex=None):
"""
Create patch include paths, i.e. a "negation" of the exclude paths.
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index c0f09469..f5618ce8 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -30,8 +30,9 @@ from gbp.errors import GbpError
import gbp.log
from gbp.patch_series import (PatchSeries, Patch)
from gbp.scripts.common.pq import (is_pq_branch, pq_branch_name, pq_branch_base,
- format_patch, switch_to_pq_branch,
- apply_single_patch, apply_and_commit_patch,
+ parse_gbp_commands, format_patch,
+ switch_to_pq_branch, apply_single_patch,
+ apply_and_commit_patch,
drop_pq, get_maintainer_from_control)
PATCH_DIR = "debian/patches/"
@@ -53,8 +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)
- format_patch(outdir, repo, info, patches, options.patch_numbers,
- topic_regex=topic_regex)
+ cmds = parse_gbp_commands(info, 'gbp', ('ignore'), None)
+ if not 'ignore' in cmds:
+ format_patch(outdir, repo, info, patches, options.patch_numbers,
+ topic_regex=topic_regex)
+ else:
+ gbp.log.info('Ignoring commit %s' % info['id'])
return patches