Skip to content

Commit

Permalink
Create a branch for the merge, so it's easier to do local testing
Browse files Browse the repository at this point in the history
without having to constantly revert out of master.
  • Loading branch information
fperez committed May 24, 2013
1 parent c751c59 commit 06ca4b2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/git-mpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
# -*- coding: utf-8 -*-
"""
Usage:
python git-mpr.py -m 1657
git-mpr [-h] [-l | -a] [pr-number [pr-number ...]]
Type `git mpr -h` for details.
"""

from __future__ import print_function

import io, os
Expand Down Expand Up @@ -31,7 +34,13 @@ def merge_branch(repo, branch ):
return False
return True


def git_new_branch(name):
"""Create a new branch with the given name and check it out.
"""
check_call(['git', 'checkout', '-b', name])


def merge_pr(num):
""" try to merge the branch of PR `num` into current branch
"""
Expand Down Expand Up @@ -95,12 +104,16 @@ def main(*args):
ismgb=ismgb))

if(args.merge_all):
branch_name = 'merge-' + '-'.join(str(pr['number']) for pr in pr_list)
git_new_branch(branch_name)
pr_list = gh_api.get_pulls_list(gh_project)
for pr in pr_list :
merge_pr(pr['number'])


elif args.merge:
branch_name = 'merge-' + '-'.join(map(str, args.merge))
git_new_branch(branch_name)
for num in args.merge :
merge_pr(num)

Expand Down

0 comments on commit 06ca4b2

Please sign in to comment.