##// END OF EJS Templates
fix mpr...
Matthias BUSSONNIER -
Show More
@@ -31,20 +31,14 b' def merge_branch(repo, branch ):'
31 return True
31 return True
32
32
33
33
34 def merge_pr(num, github_api=3):
34 def merge_pr(num):
35 """ try to merge the branch of PR `num` into current branch
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 # Get Github authorisation first, so that the user is prompted straight away
37 # Get Github authorisation first, so that the user is prompted straight away
41 # if their login is needed.
38 # if their login is needed.
42
39
43 pr = gh_api.get_pull_request(gh_project, num, github_api)
40 pr = gh_api.get_pull_request(gh_project, num)
44 if github_api == 2:
41 repo = pr['head']['repo']['clone_url']
45 repo = pr['head']['repository']['url']
46 elif github_api == 3 :
47 repo = pr['head']['repo']['clone_url']
48
42
49
43
50 branch = pr['head']['ref']
44 branch = pr['head']['ref']
@@ -90,15 +84,11 b' def main(*args):'
90 nargs='*',
84 nargs='*',
91 metavar='pr-number')
85 metavar='pr-number')
92 args = parser.parse_args()
86 args = parser.parse_args()
93 if args.githubapiv2 == 2 :
94 github_api = 2
95 else :
96 github_api = 3
97
87
98 if(args.list):
88 if(args.list):
99 pr_list = gh_api.get_pulls_list(gh_project, github_api)
89 pr_list = gh_api.get_pulls_list(gh_project)
100 for pr in pr_list :
90 for pr in pr_list :
101 mergeable = gh_api.get_pull_request(gh_project, pr['number'], github_api=github_api)['mergeable']
91 mergeable = gh_api.get_pull_request(gh_project, pr['number'])['mergeable']
102
92
103 ismgb = u"√" if mergeable else " "
93 ismgb = u"√" if mergeable else " "
104 print(u"* #{number} [{ismgb}]: {title}".format(
94 print(u"* #{number} [{ismgb}]: {title}".format(
@@ -114,7 +104,7 b' def main(*args):'
114
104
115 elif args.merge:
105 elif args.merge:
116 for num in args.merge :
106 for num in args.merge :
117 merge_pr(num, github_api=github_api)
107 merge_pr(num)
118
108
119 if not_merged :
109 if not_merged :
120 print('*************************************************************************************')
110 print('*************************************************************************************')
General Comments 0
You need to be logged in to leave comments. Login now