Repository: ipython/ipython

Issue:
Unknown option `no-edit` in git-mpr
This one is mostly for @Carreau: I just tried git mpr again, and this is what I got.  Does it actually work for you on linux? This is on a linux 12.04 box with git 1.7.9.5.

```
(master)longs[ipython]> git mpr -m 2179
error: unknown option `no-edit'
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [(<repository> | <group>)...]
   or: git fetch --all [<options>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <path>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune remote-tracking branches no longer on remote
    --recurse-submodules[=<on-demand>]
                          control recursive fetching of submodules
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <depth>       deepen history of shallow clone

fatal: There is no merge to abort (MERGE_HEAD missing).
Traceback (most recent call last):
  File "/home/fperez/usr/bin//git-mpr", line 117, in <module>
    main()
  File "/home/fperez/usr/bin//git-mpr", line 107, in main
    merge_pr(num)
  File "/home/fperez/usr/bin//git-mpr", line 46, in merge_pr
    branch=branch,
  File "/home/fperez/usr/bin//git-mpr", line 29, in merge_branch
    check_call(['git', 'merge', '--abort'])
  File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'merge', '--abort']' returned non-zero exit status 128
```



Discussion:
So it is running `git pull --no-edit {repo} {branch}`.  Not sure why you got the help for `git fetch`... I assume that's because pull is just fetch + merge.

Looks like the `--no-edit` option might not have been in `git pull` until version [1.7.9.6](http://git-scm.com/docs/git-pull/1.7.9.6).  (In particular, I don't see it in the man page for [1.7.9.5](http://git-scm.com/docs/git-pull/1.7.9.5).  **Edit**: Looking through the git source however, I don't see how this could have been introduced in the changed between those versions.

Maybe we need to separate this into separate calls to `git fetch` and `git merge` ?

That sound like a good idea...

doing separate calls to fetch and merge is not the solution as the merge might still wait for the user to enter a commit message without the `--no-edit` option.
One solution woud be to generate the message ourselves and use the `-m` option. I can also try the `--quiet` option.

Since this is mostly for temporary testing (we use the github UI for the actual merges), I think an auto-generated message is OK.  Right now, git-mpr is unfortunately unusable even on ubuntu 12.04, which means I can't use it...


Resolving patch:
diff --git a/tools/git-mpr.py b/tools/git-mpr.py
--- a/tools/git-mpr.py
+++ b/tools/git-mpr.py
@@ -6,6 +6,7 @@
 """
 from __future__ import print_function
 
+import io, os
 import argparse
 from subprocess import check_call, CalledProcessError
 
@@ -24,7 +25,7 @@ def merge_branch(repo, branch ):
     """
     # Delete the branch first
     try :
-        check_call(['git', 'pull', '--no-edit', repo, branch])
+        check_call(['git', 'pull', repo, branch], stdin=io.open(os.devnull))
     except CalledProcessError :
         check_call(['git', 'merge', '--abort'])
         return False
@@ -57,13 +58,11 @@ def merge_pr(num):
 def main(*args):
     parser = argparse.ArgumentParser(
             description="""
-                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.
+                Merge one or more github pull requests by their number. If any
+                one pull request can't be merged as is, its merge is ignored
+                and the process continues with the next ones (if any).
                 """
             )
-    parser.add_argument('-v2', '--githubapiv2', action='store_const', const=2)
 
     grp = parser.add_mutually_exclusive_group()
     grp.add_argument(
@@ -77,8 +76,7 @@ def main(*args):
             action='store_const',
             const=True ,
             help='try to merge as many PR as possible, one by one')
-    grp.add_argument('-m',
-            '--merge',
+    parser.add_argument('integers',
             type=int,
             help="The pull request numbers",
             nargs='*',


Test patch: