You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2019/07/06 21:31:06 UTC

[arrow] branch master updated: ARROW-5865: [Release] Helper script to rebase PRs on master

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c2c9e99  ARROW-5865: [Release] Helper script to rebase PRs on master
c2c9e99 is described below

commit c2c9e99140363545521f957219e3eba71a98c804
Author: Micah Kornfield <em...@gmail.com>
AuthorDate: Sun Jul 7 06:29:49 2019 +0900

    ARROW-5865: [Release] Helper script to rebase PRs on master
    
    This make a script that will generate shell commands to force push all branchs.
    
    Author: Micah Kornfield <em...@gmail.com>
    
    Closes #4814 from emkornfield/make_script_for_force_push and squashes the following commits:
    
    ce9bf9a41 <Micah Kornfield> Adrress PR feedback
    c4a14f5e6 <Micah Kornfield> fix flake8
    033c8703f <Micah Kornfield> ARROW-5865:  Helper script to rebase PRs on master
---
 dev/release/generate_force_push_script.py | 61 +++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/dev/release/generate_force_push_script.py b/dev/release/generate_force_push_script.py
new file mode 100755
index 0000000..b6cd760
--- /dev/null
+++ b/dev/release/generate_force_push_script.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+##############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+##############################################################################
+
+# This script generates a series of shell commands
+# to rebase all open pull requests off of master
+# and force push the updates.
+
+from http.client import HTTPSConnection
+import json
+from collections import defaultdict
+
+client = HTTPSConnection('api.github.com')
+client.request('GET',
+               '/repos/apache/arrow/pulls?state=open&per_page=100',
+               headers={'User-Agent': 'ApacheArrowRebaser'})
+response = client.getresponse()
+json_content = response.read()
+if response.status != 200:
+    error_msg = 'GitHub connection error:{}'.format(json_content)
+    raise Exception(error_msg)
+
+parsed_content = json.loads(json_content)
+if len(parsed_content) == 100:
+    print("# WARNING: Only the most recent 100 PRs will be processed")
+
+repos = defaultdict(list)
+for pr in parsed_content:
+    head = pr['head']
+    repos[head['repo']['full_name']].append(head['label'])
+
+for repo, labels in repos.items():
+    print('git clone git@github.com:{}.git'.format(repo))
+    print('cd arrow')
+    print('git remote add upstream https://github.com/apache/arrow.git')
+    print('git fetch --all --prune --tags --force')
+    for label in labels:
+        # Labels are in the form 'user:branch'
+        owner, branch = label.split(':')
+        print('git checkout {}'.format(branch))
+        print('(git rebase upstream/master && git push --force) || ' +
+              '(echo "Rebase failed for {}" && '.format(label) +
+              'git rebase --abort)')
+    print('cd ..')
+    print('rm -rf arrow')