You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by kw...@apache.org on 2018/01/27 00:03:41 UTC

[2/3] impala git commit: IMPALA-6410: compare_branches: use looser expression

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 <tb...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/5ca603a3
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/5ca603a3
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/5ca603a3

Branch: refs/heads/master
Commit: 5ca603a3769d23c2085bc37d6261517cf0bbcb6e
Parents: 2ee2c4f
Author: Philip Zeyliger <ph...@cloudera.com>
Authored: Thu Jan 25 09:05:12 2018 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Fri Jan 26 22:45:57 2018 +0000

----------------------------------------------------------------------
 bin/compare_branches.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/5ca603a3/bin/compare_branches.py
----------------------------------------------------------------------
diff --git a/bin/compare_branches.py b/bin/compare_branches.py
index 7050924..fddb17e 100755
--- a/bin/compare_branches.py
+++ b/bin/compare_branches.py
@@ -103,8 +103,9 @@ def create_parser():
       os.path.dirname(os.path.abspath(__file__)), 'ignored_commits.json')
   parser.add_argument('--ignored_commits_file', default=default_ignored_commits_path,
       help='JSON File that contains ignored commits as specified in the help')
-  parser.add_argument('--skip_commits_matching', default="Cherry-picks: not for {branch}",
-      help='String in commit messages that causes the commit to be ignored. ' +
+  parser.add_argument('--skip_commits_matching',
+      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')
   parser.add_argument('--verbose', '-v', action='store_true', default=False,
       help='Turn on DEBUG and INFO logging')
@@ -232,14 +233,14 @@ def main():
   print '-' * 80
   jira_keys = []
   jira_key_pat = re.compile(r'(IMPALA-\d+)')
-  skip_commits_matching = options.skip_commits_matching.replace(
-      "{branch}", options.target_branch)
+  skip_commits_matching = options.skip_commits_matching.format(
+      branch=options.target_branch)
   for change_id, (commit_hash, msg, author, date, body) in source_commits.iteritems():
     change_in_target = change_id in target_commits
     ignore_by_config = commit_hash in ignored_commits[
         (options.source_branch, options.target_branch)]
-    ignore_by_commit_message = skip_commits_matching.lower() in msg.lower() \
-        or skip_commits_matching.lower() in body.lower()
+    ignore_by_commit_message = re.search(skip_commits_matching, "\n".join([msg, body]),
+        re.IGNORECASE)
     # This conditional block just for debug logging of ignored commits
     if ignore_by_config or ignore_by_commit_message:
       if change_in_target: