You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2021/04/01 05:34:33 UTC

[impala] 03/03: Only fetch needed branches in compare_branches.py

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

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit d8ef9562cc6491f5d4de1a2229d0abc35dd44662
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Wed Mar 31 16:44:42 2021 +0800

    Only fetch needed branches in compare_branches.py
    
    Fetching all branches of a remote repo will be time-consuming. This
    changes compare_branches.py to only fetch the needed branches, i.e.
    source_branch and target_branch.
    
    Tests:
     - Before this change, it can't finish in 30 mins when comparing two
       downstream branches. After this change, it finishes in one minute.
    
    Change-Id: Ia0c70ad4de1fa79498ca32853b6ea99aee2d40a7
    Reviewed-on: http://gerrit.cloudera.org:8080/17246
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 bin/compare_branches.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/compare_branches.py b/bin/compare_branches.py
index a3ae299..f57aad1 100755
--- a/bin/compare_branches.py
+++ b/bin/compare_branches.py
@@ -213,13 +213,16 @@ def main():
   # Ensure all branches are up to date, unless remotes are disabled
   # by specifying them with an empty string.
   if options.source_remote_name != "":
-    subprocess.check_call(['git', 'fetch', options.source_remote_name])
+    subprocess.check_call(['git', 'fetch', options.source_remote_name,
+        options.source_branch])
     full_source_branch_name = options.source_remote_name + '/' + options.source_branch
   else:
     full_source_branch_name = options.source_branch
   if options.target_remote_name != "":
-    if options.source_remote_name != options.target_remote_name:
-      subprocess.check_call(['git', 'fetch', options.target_remote_name])
+    if options.source_remote_name != options.target_remote_name\
+        or options.source_branch != options.target_branch:
+      subprocess.check_call(['git', 'fetch', options.target_remote_name,
+          options.target_branch])
     full_target_branch_name = options.target_remote_name + '/' + options.target_branch
   else:
     full_target_branch_name = options.target_branch