Show More
@@ -6,11 +6,8 b' Usage:' | |||||
6 | """ |
|
6 | """ | |
7 | from __future__ import print_function |
|
7 | from __future__ import print_function | |
8 |
|
8 | |||
9 | import re |
|
|||
10 | import requests |
|
|||
11 | import argparse |
|
9 | import argparse | |
12 |
from subprocess import |
|
10 | from subprocess import check_call, CalledProcessError | |
13 | import sys |
|
|||
14 |
|
11 | |||
15 | import gh_api |
|
12 | import gh_api | |
16 |
|
13 | |||
@@ -18,15 +15,13 b" ipy_repository = 'git://github.com/ipython/ipython.git'" | |||||
18 | gh_project="ipython/ipython" |
|
15 | gh_project = "ipython/ipython" | |
19 | not_merged={} |
|
16 | not_merged = {} | |
20 |
|
17 | |||
21 |
|
18 | def merge_branch(repo, branch ): | ||
22 | def merge_branch(repo, branch, owner, mergeable): |
|
|||
23 | """try to merge the givent branch into the current one |
|
19 | """try to merge the givent branch into the current one | |
24 |
|
20 | |||
25 | If something does not goes smoothly, merge is aborted |
|
21 | If something does not goes smoothly, merge is aborted | |
26 |
|
22 | |||
27 | Returns True if merge sucessfull, False otherwise |
|
23 | Returns True if merge sucessfull, False otherwise | |
28 | """ |
|
24 | """ | |
29 | merged_branch = "%s-%s" % (owner, branch) |
|
|||
30 | # Delete the branch first |
|
25 | # Delete the branch first | |
31 | try : |
|
26 | try : | |
32 | check_call(['git', 'pull','--no-edit',repo, branch]) |
|
27 | check_call(['git', 'pull', '--no-edit', repo, branch]) | |
@@ -48,17 +43,13 b' def merge_pr(num,github_api=3):' | |||||
48 | pr = gh_api.get_pull_request(gh_project, num, github_api) |
|
43 | pr = gh_api.get_pull_request(gh_project, num, github_api) | |
49 | if github_api == 2: |
|
44 | if github_api == 2: | |
50 | repo = pr['head']['repository']['url'] |
|
45 | repo = pr['head']['repository']['url'] | |
51 | owner = pr['head']['user']['name'] |
|
|||
52 | elif github_api == 3 : |
|
46 | elif github_api == 3 : | |
53 | repo = pr['head']['repo']['clone_url'] |
|
47 | repo = pr['head']['repo']['clone_url'] | |
54 | owner = pr['head']['repo']['owner']['login'] |
|
|||
55 |
|
48 | |||
56 |
|
49 | |||
57 | branch = pr['head']['ref'] |
|
50 | branch = pr['head']['ref'] | |
58 | mergeable = merge_branch(repo=repo, |
|
51 | mergeable = merge_branch(repo=repo, | |
59 | branch=branch, |
|
52 | branch=branch, | |
60 | owner=owner, |
|
|||
61 | mergeable=pr['mergeable'], |
|
|||
62 | ) |
|
53 | ) | |
63 | if not mergeable : |
|
54 | if not mergeable : | |
64 | cmd = "git pull "+repo+" "+branch |
|
55 | cmd = "git pull "+repo+" "+branch | |
@@ -98,7 +89,6 b' def main(*args):' | |||||
98 | help="The pull request numbers", |
|
89 | help="The pull request numbers", | |
99 | nargs='*', |
|
90 | nargs='*', | |
100 | metavar='pr-number') |
|
91 | metavar='pr-number') | |
101 | not_merged = {}; |
|
|||
102 | args = parser.parse_args() |
|
92 | args = parser.parse_args() | |
103 | if args.githubapiv2 == 2 : |
|
93 | if args.githubapiv2 == 2 : | |
104 | github_api = 2 |
|
94 | github_api = 2 |
General Comments 0
You need to be logged in to leave comments.
Login now