]>
git.proxmox.com Git - ceph.git/blob - ceph/src/script/build-integration-branch
3 from __future__
import print_function
8 from subprocess
import call
12 from urllib
.parse
import urljoin
14 from urlparse
import urljoin
19 with
open(os
.environ
['HOME'] + '/.github_token', 'r') as myfile
:
20 token
= myfile
.readline().strip()
23 baseurl
= urljoin('https://api.github.com',
24 'repos/{repo}/issues?labels={label}&access_token={token}')
31 j
= json
.loads(r
.text
or r
.content
)
32 print("--- found %d issues tagged with %s" % (len(j
), label
))
37 if 'pull_request' not in issue
:
39 r
= requests
.get(issue
['pull_request']['url'] + '?access_token=' + token
)
40 pr
= json
.loads(r
.text
or r
.content
)
42 prtext
.append(pr
['html_url'] + ' - ' + pr
['title'])
43 print("--- queried %s prs" % len(prs
))
46 TIME_FORMAT
= '%Y-%m-%d-%H%M'
47 branch
= label
+ "-" + time
.strftime(TIME_FORMAT
, time
.localtime())
48 print("branch %s" % branch
)
51 print('--- creating branch %s' % branch
)
52 r
= call(['git', 'checkout', '-b', branch
])
55 print('--- pr %d --- pulling %s branch %s' % (
57 pr
['head']['repo']['clone_url'],
59 r
= call(['git', 'pull', '--no-edit',
60 pr
['head']['repo']['clone_url'],
63 print('--- done. these PRs were included:')
64 print('\n'.join(prtext
).encode('ascii', errors
='ignore').decode())
65 print('--- perhaps you want to: make && ctest -j12 && git push ci %s' % branch
)