Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github, merge PR(s) just by number(s) #1759

Merged
merged 5 commits into from Jun 13, 2012
Merged

github, merge PR(s) just by number(s) #1759

merged 5 commits into from Jun 13, 2012

Conversation

Carreau
Copy link
Member

@Carreau Carreau commented May 23, 2012

inspired by git-mrb and test_pr, I thougth it would be usefull to be able to merge PR only by giving their number. Hence git merge-pull-requestor git-mpr. (as it is in tool, the code is not really clean, full of typos...etc)

usage:

$ git mpr -h                                                                          ~/ipython/tools
usage: git-mpr [-h] [-l | -a | -m [pr-number [pr-number ...]]]

Merge (one|many) github pull request by their number. If pull request can't be
merge as is, cancel merge, and continue to the next if any.

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            list PR, their number and their mergeability
  -a, --merge-all       try to merge as many PR as possible, one by one
  -m [pr-number [pr-number ...]], --merge [pr-number [pr-number ...]]
                        The pull request numbers

examples :

$ git mpr --list  
* #1758 [√]:  test_pr, fallback on http if git protocol fail, and SSL errors...
* #1755 [√]:  test for pygments before running qt tests
* #1715 [√]:  Fix for #1688, traceback-unicode issue
[...]
* #1493 [√]:  Selenium web tests proof-of-concept
* #1471 [ ]:  simplify IPython.parallel connections and enable Controller Resume
* #1343 [ ]:  Add prototype shutdown button to Notebook dashboard
* #1285 [√]:  Implementation of grepping the input history using several patterns
* #1215 [√]:  updated %quickref to show short-hand for %sc and %sx

PR number, mergeability and title
Quite slow, as it does 1 api call by PR, since api does not give mergeability anymore if you ask for the list of all PRs at once.

merge one or more PR (skip the ones with conflict and present a nice list to copy and past to do it by hand)

$ git mpr --merge [pr-number [pr-number ...]]]
[...]
*************************************************************************************
the following branch have not been merged automatically, considere doing it by hand :
PR 1630: git pull https://github.com/minrk/ipython.git mergekernel
PR 1343: git pull https://github.com/takluyver/ipython.git notebook-shutdown
PR 1715: git pull https://github.com/jstenar/ipython.git ultratb-pycolorize-unicode
PR 1732: git pull https://github.com/fperez/ipython.git cellmagics
PR 1471: git pull https://github.com/minrk/ipython.git connection
PR 1674: git pull https://github.com/mdboom/ipython.git notebook-carriage-return
*************************************************************************************

And last,

git mpr --merge-all

That is pretty self explainatory

Oh, and I also learn that if you have a git-xxx(with dash) in your PATH, git is smart and call it when you invoke git xxx(without dash)

with options :

merge PR -m number [number ...]
lists pull request (-l)
use github v2 (-v2) api (sorry for me i've issues with v3/https/proxy)
@Carreau
Copy link
Member Author

Carreau commented Jun 1, 2012

Ok, I ve re-wrote most of it to work both with github api-v3 and api-v2 this allows me to use it by just appending a -v2 flag.

I'll try to see f I could improve git mrb to also be able to use only pr number.

# -*- coding: utf-8 -*-
"""
Usage:
python test_pr.py 1657
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You left the old test_pr name here :)

@fperez
Copy link
Member

fperez commented Jun 10, 2012

This is great, you read my mind! Just this morning I was thinking, "boy, we really need to write something like a 'git mpr'" tool, as we're starting to get way too many PRs from people I'm not tracking. And as I scroll down the PR list, it turns out you'd done it already! :)

A few easy fixes and this will be good to go. Excellent work.

@Carreau
Copy link
Member Author

Carreau commented Jun 12, 2012

I did some cleaning, and fixed some of your comment.
Sorry I'm really low and bandwidth right now, so I haven't fully re-test.
It does not have the option to make the merge on a new branch like git-mrb does,and then revert after, it would be good to have.
If somebody want to do it, go ahead.

Also if someone now ruby, it would be a good idead to send a patch to a project like hub , I tried , but I need more knowledge than what I have now, and don't have much time to acquire it.

@fperez
Copy link
Member

fperez commented Jun 13, 2012

OK, let's merge this: given that it's a new tool and for developers only, we can polish it as we start using it and find what needs improving. But it will be great to have already, and that's how these things get better: by beating them in use.

Many thanks, I'm really happy to see this in!

fperez added a commit that referenced this pull request Jun 13, 2012
Add git-mpr, to merge PR(s) from github just by number(s).

Inspired by git-mrb and test_pr, I thougth it would be usefull to be able to merge PR only by giving their number. Hence `git merge-pull-request`or `git-mpr`.

usage: 
```bash
$ git mpr -h                                                                          ~/ipython/tools
usage: git-mpr [-h] [-l | -a | -m [pr-number [pr-number ...]]]

Merge (one|many) github pull request by their number. If pull request can't be
merge as is, cancel merge, and continue to the next if any.

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            list PR, their number and their mergeability
  -a, --merge-all       try to merge as many PR as possible, one by one
  -m [pr-number [pr-number ...]], --merge [pr-number [pr-number ...]]
                        The pull request numbers
```

examples :
```bash
$ git mpr --list  
* #1758 [√]:  test_pr, fallback on http if git protocol fail, and SSL errors...
* #1755 [√]:  test for pygments before running qt tests
* #1715 [√]:  Fix for #1688, traceback-unicode issue
[...]
* #1493 [√]:  Selenium web tests proof-of-concept
* #1471 [ ]:  simplify IPython.parallel connections and enable Controller Resume
* #1343 [ ]:  Add prototype shutdown button to Notebook dashboard
* #1285 [√]:  Implementation of grepping the input history using several patterns
* #1215 [√]:  updated %quickref to show short-hand for %sc and %sx
```
PR number, mergeability and title
Quite slow, as it does 1 api call by PR, since api does not give mergeability anymore if you ask for the list of all PRs at once.

merge one or more PR (skip the ones with conflict and present a nice list to copy and past to do it by hand) 

```bash
$ git mpr --merge [pr-number [pr-number ...]]]
[...]
*************************************************************************************
the following branch have not been merged automatically, considere doing it by hand :
PR 1630: git pull https://github.com/minrk/ipython.git mergekernel
PR 1343: git pull https://github.com/takluyver/ipython.git notebook-shutdown
PR 1715: git pull https://github.com/jstenar/ipython.git ultratb-pycolorize-unicode
PR 1732: git pull https://github.com/fperez/ipython.git cellmagics
PR 1471: git pull https://github.com/minrk/ipython.git connection
PR 1674: git pull https://github.com/mdboom/ipython.git notebook-carriage-return
*************************************************************************************
```

And last, 
```
git mpr --merge-all
```

That is pretty self explainatory
@fperez fperez merged commit 029bbad into ipython:master Jun 13, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Add git-mpr, to merge PR(s) from github just by number(s).

Inspired by git-mrb and test_pr, I thougth it would be usefull to be able to merge PR only by giving their number. Hence `git merge-pull-request`or `git-mpr`.

usage: 
```bash
$ git mpr -h                                                                          ~/ipython/tools
usage: git-mpr [-h] [-l | -a | -m [pr-number [pr-number ...]]]

Merge (one|many) github pull request by their number. If pull request can't be
merge as is, cancel merge, and continue to the next if any.

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            list PR, their number and their mergeability
  -a, --merge-all       try to merge as many PR as possible, one by one
  -m [pr-number [pr-number ...]], --merge [pr-number [pr-number ...]]
                        The pull request numbers
```

examples :
```bash
$ git mpr --list  
* ipython#1758 [√]:  test_pr, fallback on http if git protocol fail, and SSL errors...
* ipython#1755 [√]:  test for pygments before running qt tests
* ipython#1715 [√]:  Fix for ipython#1688, traceback-unicode issue
[...]
* ipython#1493 [√]:  Selenium web tests proof-of-concept
* ipython#1471 [ ]:  simplify IPython.parallel connections and enable Controller Resume
* ipython#1343 [ ]:  Add prototype shutdown button to Notebook dashboard
* ipython#1285 [√]:  Implementation of grepping the input history using several patterns
* ipython#1215 [√]:  updated %quickref to show short-hand for %sc and %sx
```
PR number, mergeability and title
Quite slow, as it does 1 api call by PR, since api does not give mergeability anymore if you ask for the list of all PRs at once.

merge one or more PR (skip the ones with conflict and present a nice list to copy and past to do it by hand) 

```bash
$ git mpr --merge [pr-number [pr-number ...]]]
[...]
*************************************************************************************
the following branch have not been merged automatically, considere doing it by hand :
PR 1630: git pull https://github.com/minrk/ipython.git mergekernel
PR 1343: git pull https://github.com/takluyver/ipython.git notebook-shutdown
PR 1715: git pull https://github.com/jstenar/ipython.git ultratb-pycolorize-unicode
PR 1732: git pull https://github.com/fperez/ipython.git cellmagics
PR 1471: git pull https://github.com/minrk/ipython.git connection
PR 1674: git pull https://github.com/mdboom/ipython.git notebook-carriage-return
*************************************************************************************
```

And last, 
```
git mpr --merge-all
```

That is pretty self explainatory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants