diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/script/build-integration-branch | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/script/build-integration-branch')
-rwxr-xr-x | src/script/build-integration-branch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/script/build-integration-branch b/src/script/build-integration-branch new file mode 100755 index 00000000..a15d88cd --- /dev/null +++ b/src/script/build-integration-branch @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +import json +import os +import requests +from subprocess import call +import sys +import time +try: + from urllib.parse import urljoin +except: + from urlparse import urljoin + +label = sys.argv[1] +repo = "ceph/ceph" + +with open(os.environ['HOME'] + '/.github_token', 'r') as myfile: + token = myfile.readline().strip() + +# get prs +baseurl = urljoin('https://api.github.com', ( + 'repos/{repo}/issues?labels={label}' + '&access_token={token}' + '&sort=created' + '&direction=asc' + ) + ) +url = baseurl.format( + label=label, + repo=repo, + token=token) +r = requests.get(url) +assert(r.ok) +j = json.loads(r.text or r.content) +print("--- found %d issues tagged with %s" % (len(j), label)) + +prs = [] +prtext = [] +for issue in j: + if 'pull_request' not in issue: + continue + r = requests.get(issue['pull_request']['url'] + '?access_token=' + token) + pr = json.loads(r.text or r.content) + prs.append(pr) + prtext.append(pr['html_url'] + ' - ' + pr['title']) +print("--- queried %s prs" % len(prs)) + +# name branch +TIME_FORMAT = '%Y-%m-%d-%H%M' +branch = label + "-" + time.strftime(TIME_FORMAT, time.localtime()) +print("branch %s" % branch) + +# assemble +print('--- creating branch %s' % branch) +r = call(['git', 'checkout', '-b', branch]) +assert not r +for pr in prs: + print('--- pr %d --- pulling %s branch %s' % ( + pr['number'], + pr['head']['repo']['clone_url'], + pr['head']['ref'])) + r = call(['git', 'pull', '--no-edit', + pr['head']['repo']['clone_url'], + pr['head']['ref']]) + assert not r +print('--- done. these PRs were included:') +print('\n'.join(prtext).encode('ascii', errors='ignore').decode()) +print('--- perhaps you want to: make && ctest -j12 && git push ci %s' % branch) |