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