Show More
@@ -31,19 +31,13 b' def merge_branch(repo, branch ):' | |||
|
31 | 31 | return True |
|
32 | 32 | |
|
33 | 33 | |
|
34 |
def merge_pr(num |
|
|
34 | def merge_pr(num): | |
|
35 | 35 | """ try to merge the branch of PR `num` into current branch |
|
36 | ||
|
37 | github_api : use github api v2 (to bypass https and issues with proxy) to find the | |
|
38 | remote branch that should be merged by it's number | |
|
39 | 36 | """ |
|
40 | 37 | # Get Github authorisation first, so that the user is prompted straight away |
|
41 | 38 | # if their login is needed. |
|
42 | 39 | |
|
43 |
pr = gh_api.get_pull_request(gh_project, num |
|
|
44 | if github_api == 2: | |
|
45 | repo = pr['head']['repository']['url'] | |
|
46 | elif github_api == 3 : | |
|
40 | pr = gh_api.get_pull_request(gh_project, num) | |
|
47 | 41 |
|
|
48 | 42 | |
|
49 | 43 | |
@@ -90,15 +84,11 b' def main(*args):' | |||
|
90 | 84 | nargs='*', |
|
91 | 85 | metavar='pr-number') |
|
92 | 86 | args = parser.parse_args() |
|
93 | if args.githubapiv2 == 2 : | |
|
94 | github_api = 2 | |
|
95 | else : | |
|
96 | github_api = 3 | |
|
97 | 87 | |
|
98 | 88 | if(args.list): |
|
99 |
pr_list = gh_api.get_pulls_list(gh_project |
|
|
89 | pr_list = gh_api.get_pulls_list(gh_project) | |
|
100 | 90 | for pr in pr_list : |
|
101 |
mergeable = gh_api.get_pull_request(gh_project, pr['number'] |
|
|
91 | mergeable = gh_api.get_pull_request(gh_project, pr['number'])['mergeable'] | |
|
102 | 92 | |
|
103 | 93 | ismgb = u"√" if mergeable else " " |
|
104 | 94 | print(u"* #{number} [{ismgb}]: {title}".format( |
@@ -114,7 +104,7 b' def main(*args):' | |||
|
114 | 104 | |
|
115 | 105 | elif args.merge: |
|
116 | 106 | for num in args.merge : |
|
117 |
merge_pr(num |
|
|
107 | merge_pr(num) | |
|
118 | 108 | |
|
119 | 109 | if not_merged : |
|
120 | 110 | print('*************************************************************************************') |
General Comments 0
You need to be logged in to leave comments.
Login now