Show More
@@ -2,8 +2,11 b'' | |||
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | """ |
|
4 | 4 | Usage: |
|
5 | python git-mpr.py -m 1657 | |
|
5 | git-mpr [-h] [-l | -a] [pr-number [pr-number ...]] | |
|
6 | ||
|
7 | Type `git mpr -h` for details. | |
|
6 | 8 | """ |
|
9 | ||
|
7 | 10 | from __future__ import print_function |
|
8 | 11 | |
|
9 | 12 | import io, os |
@@ -31,7 +34,13 b' def merge_branch(repo, branch ):' | |||
|
31 | 34 | return False |
|
32 | 35 | return True |
|
33 | 36 | |
|
37 | ||
|
38 | def git_new_branch(name): | |
|
39 | """Create a new branch with the given name and check it out. | |
|
40 | """ | |
|
41 | check_call(['git', 'checkout', '-b', name]) | |
|
34 | 42 | |
|
43 | ||
|
35 | 44 | def merge_pr(num): |
|
36 | 45 | """ try to merge the branch of PR `num` into current branch |
|
37 | 46 | """ |
@@ -95,12 +104,16 b' def main(*args):' | |||
|
95 | 104 | ismgb=ismgb)) |
|
96 | 105 | |
|
97 | 106 | if(args.merge_all): |
|
107 | branch_name = 'merge-' + '-'.join(str(pr['number']) for pr in pr_list) | |
|
108 | git_new_branch(branch_name) | |
|
98 | 109 | pr_list = gh_api.get_pulls_list(gh_project) |
|
99 | 110 | for pr in pr_list : |
|
100 | 111 | merge_pr(pr['number']) |
|
101 | 112 | |
|
102 | 113 | |
|
103 | 114 | elif args.merge: |
|
115 | branch_name = 'merge-' + '-'.join(map(str, args.merge)) | |
|
116 | git_new_branch(branch_name) | |
|
104 | 117 | for num in args.merge : |
|
105 | 118 | merge_pr(num) |
|
106 | 119 |
General Comments 0
You need to be logged in to leave comments.
Login now