You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by tm...@apache.org on 2019/06/19 16:57:22 UTC

[impala] branch 2.x updated: IMPALA-8669 Support giving a terminal commit in compare_branches.py

This is an automated email from the ASF dual-hosted git repository.

tmarshall pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 943357f  IMPALA-8669 Support giving a terminal commit in compare_branches.py
943357f is described below

commit 943357f8a44840c55b4fbbbe60fea4b28a08ed28
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Sat Jun 15 20:25:19 2019 -0700

    IMPALA-8669 Support giving a terminal commit in compare_branches.py
    
    Currently, bin/compare_branches.py (used in cherrypick-2.x-and-test
    Jenkins job) will cherry-pick as more commits as possible. However, a
    clean pick from the master branch does not mean it can always pass the
    tests. If we find such a problematic commit, we'd like to let the
    cherrypick-2.x-and-test Jenkins job cherry-pick till the commit before
    it. And then submit only a patch for the problematic commit for review.
    
    This patch adds a new parameter "source_terminal_commit" for specifying
    where to stop. It's the full commit hash of the terminal commit in the
    source branch. bin/compare_branches.py will stop after cherry-picking
    this commit.
    
    Tests:
     - Test locally by pushing the 2.x branch to my repo ("self") and run
       bin/compare_branches.py --cherry_pick --partial_ok \
         --source_remote_name asf-gerrit --target_remote_name self -v \
         --source_terminal_commit def5c881b1dee93848daea52d93a0602e11338ca
    
    Change-Id: I7a4dfae26f8f616c6f550114edfbafd6fc1c068d
    Reviewed-on: http://gerrit.cloudera.org:8080/13660
    Reviewed-by: Tim Armstrong <ta...@cloudera.com>
    Tested-by: Quanlong Huang <hu...@gmail.com>
---
 bin/compare_branches.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/bin/compare_branches.py b/bin/compare_branches.py
index 8b54636..399d5c5 100755
--- a/bin/compare_branches.py
+++ b/bin/compare_branches.py
@@ -101,6 +101,8 @@ def create_parser():
   parser.add_argument('--target_remote_name', default=None,
       help='Name of the target git remote; defaults to source remote. ' +
            'Empty strings are handled the same way as --source_remote_name.')
+  parser.add_argument('--source_terminal_commit', default=None,
+      help='If set, cherrypick till this commit in the source branch.')
   default_ignored_commits_path = os.path.join(
       os.path.dirname(os.path.abspath(__file__)), 'ignored_commits.json')
   parser.add_argument('--ignored_commits_file', default=default_ignored_commits_path,
@@ -161,7 +163,8 @@ def build_commit_map(branch, merge_base):
   logging.debug("Commit map for branch %s has size %d.", branch, len(result))
   return result
 
-def cherrypick(cherry_pick_hashes, full_target_branch_name, partial_ok):
+
+def cherrypick(cherry_pick_hashes, full_target_branch_name, partial_ok, terminal_commit):
   """Cherrypicks the given commits.
 
   Also, asserts that full_target_branch_name matches the current HEAD.
@@ -199,6 +202,9 @@ def cherrypick(cherry_pick_hashes, full_target_branch_name, partial_ok):
         return
       else:
         raise Exception("Failed to cherry-pick: %s" % (cherry_pick_hash,))
+    if terminal_commit == cherry_pick_hash:
+      logging.debug("Stop at terminal commit {0}".format(cherry_pick_hash))
+      break
 
 def main():
   parser = create_parser()
@@ -281,7 +287,8 @@ def main():
                .format(pformat(commits_ignored)))
 
   if options.cherry_pick:
-    cherrypick(cherry_pick_hashes, full_target_branch_name, options.partial_ok)
+    cherrypick(cherry_pick_hashes, full_target_branch_name, options.partial_ok,
+               options.source_terminal_commit)
 
 if __name__ == '__main__':
   main()