IMPALA-6410: compare_branches: use looser expression

We've already got one use of "Cherry-pick:" instead of "Cherry-picks:"
in master, so I'm loosening the regular expression a bit. (And
converting the string search into a case-insensitive regexp search.)

I tested this by running it manually and inspecting results.

Change-Id: Ie3f75d9e01d2760571547b1a1a5f42bbc8455a05
Reviewed-on: http://gerrit.cloudera.org:8080/9135
Reviewed-by: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Tested-by: Impala Public Jenkins
This commit is contained in:
Philip Zeyliger
2018-01-25 09:05:12 -08:00
committed by Impala Public Jenkins
parent 2ee2c4fdb9
commit 5ca603a376

View File

@@ -103,8 +103,9 @@ def create_parser():
os.path.dirname(os.path.abspath(__file__)), 'ignored_commits.json') os.path.dirname(os.path.abspath(__file__)), 'ignored_commits.json')
parser.add_argument('--ignored_commits_file', default=default_ignored_commits_path, parser.add_argument('--ignored_commits_file', default=default_ignored_commits_path,
help='JSON File that contains ignored commits as specified in the help') help='JSON File that contains ignored commits as specified in the help')
parser.add_argument('--skip_commits_matching', default="Cherry-picks: not for {branch}", parser.add_argument('--skip_commits_matching',
help='String in commit messages that causes the commit to be ignored. ' + default="Cherry-pick.?:.?not (for|to) {branch}",
help='Regex searched for in commit messages that causes the commit to be ignored.' +
' {branch} is replaced with target branch; the search is case-insensitive') ' {branch} is replaced with target branch; the search is case-insensitive')
parser.add_argument('--verbose', '-v', action='store_true', default=False, parser.add_argument('--verbose', '-v', action='store_true', default=False,
help='Turn on DEBUG and INFO logging') help='Turn on DEBUG and INFO logging')
@@ -232,14 +233,14 @@ def main():
print '-' * 80 print '-' * 80
jira_keys = [] jira_keys = []
jira_key_pat = re.compile(r'(IMPALA-\d+)') jira_key_pat = re.compile(r'(IMPALA-\d+)')
skip_commits_matching = options.skip_commits_matching.replace( skip_commits_matching = options.skip_commits_matching.format(
"{branch}", options.target_branch) branch=options.target_branch)
for change_id, (commit_hash, msg, author, date, body) in source_commits.iteritems(): for change_id, (commit_hash, msg, author, date, body) in source_commits.iteritems():
change_in_target = change_id in target_commits change_in_target = change_id in target_commits
ignore_by_config = commit_hash in ignored_commits[ ignore_by_config = commit_hash in ignored_commits[
(options.source_branch, options.target_branch)] (options.source_branch, options.target_branch)]
ignore_by_commit_message = skip_commits_matching.lower() in msg.lower() \ ignore_by_commit_message = re.search(skip_commits_matching, "\n".join([msg, body]),
or skip_commits_matching.lower() in body.lower() re.IGNORECASE)
# This conditional block just for debug logging of ignored commits # This conditional block just for debug logging of ignored commits
if ignore_by_config or ignore_by_commit_message: if ignore_by_config or ignore_by_commit_message:
if change_in_target: if change_in_target: