prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN 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
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `tools/git-mpr.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 """
  4 Usage:
  5     python git-mpr.py -m 1657
  6 """
  7 from __future__ import print_function
  8 
  9 import argparse
  10 from subprocess import check_call, CalledProcessError
  11 
  12 import gh_api
  13 
  14 ipy_repository = 'git://github.com/ipython/ipython.git'
  15 gh_project = "ipython/ipython"
  16 not_merged = {}
  17 
  18 def merge_branch(repo, branch ):
  19     """try to merge the givent branch into the current one
  20     
  21     If something does not goes smoothly, merge is aborted
  22     
  23     Returns True if merge sucessfull, False otherwise
  24     """
  25     # Delete the branch first
  26     try :
  27         check_call(['git', 'pull', '--no-edit', repo, branch])
  28     except CalledProcessError :
  29         check_call(['git', 'merge', '--abort'])
  30         return False
  31     return True
  32 
  33 
  34 def merge_pr(num):
  35     """ try to merge the branch of PR `num` into current branch
  36     """
  37     # Get Github authorisation first, so that the user is prompted straight away
  38     # if their login is needed.
  39     
  40     pr = gh_api.get_pull_request(gh_project, num)
  41     repo = pr['head']['repo']['clone_url']
  42 
  43 
  44     branch = pr['head']['ref']
  45     mergeable = merge_branch(repo=repo, 
  46                  branch=branch,
  47               )
  48     if not mergeable :
  49         cmd = "git pull "+repo+" "+branch
  50         not_merged[str(num)] = cmd
  51         print("==============================================================================")
  52         print("Something went wrong merging this branch, you can try it manually by runngin :")
  53         print(cmd)
  54         print("==============================================================================")
  55         
  56     
  57 def main(*args):
  58     parser = argparse.ArgumentParser(
  59             description="""
  60                 Merge (one|many) github pull request by their number.\
  61                 
  62                 If pull request can't be merge as is, cancel merge,
  63                 and continue to the next if any.
  64                 """
  65             )
  66     parser.add_argument('-v2', '--githubapiv2', action='store_const', const=2)
  67 
  68     grp = parser.add_mutually_exclusive_group()
  69     grp.add_argument(
  70             '-l',
  71             '--list',
  72             action='store_const',
  73             const=True,
  74             help='list PR, their number and their mergeability')
  75     grp.add_argument('-a',
  76             '--merge-all',
  77             action='store_const',
  78             const=True ,
  79             help='try to merge as many PR as possible, one by one')
  80     grp.add_argument('-m',
  81             '--merge',
  82             type=int,
  83             help="The pull request numbers",
  84             nargs='*',
  85             metavar='pr-number')
  86     args = parser.parse_args()
  87 
  88     if(args.list):
  89         pr_list = gh_api.get_pulls_list(gh_project)
  90         for pr in pr_list :
  91             mergeable = gh_api.get_pull_request(gh_project, pr['number'])['mergeable']
  92 
  93             ismgb = u"√" if mergeable else " "
  94             print(u"* #{number} [{ismgb}]:  {title}".format(
  95                 number=pr['number'],
  96                 title=pr['title'],
  97                 ismgb=ismgb))
  98 
  99     if(args.merge_all):
  100         pr_list = gh_api.get_pulls_list(gh_project)
  101         for pr in pr_list :
  102             merge_pr(pr['number'])
  103 
  104 
  105     elif args.merge:
  106         for num in args.merge :
  107             merge_pr(num)
  108 
  109     if not_merged :
  110         print('*************************************************************************************')
  111         print('the following branch have not been merged automatically, considere doing it by hand :')
  112         for num, cmd in not_merged.items() :
  113             print( "PR {num}: {cmd}".format(num=num, cmd=cmd))
  114         print('*************************************************************************************')
  115 
  116 if __name__ == '__main__':
  117     main()
  118
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: 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 @@
       """
       # 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 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 @@
               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='*',
  
verification_info: {"golden_diff": "diff --git a/tools/git-mpr.py b/tools/git-mpr.py\n--- a/tools/git-mpr.py\n+++ b/tools/git-mpr.py\n@@ -6,6 +6,7 @@\n \"\"\"\n from __future__ import print_function\n \n+import io, os\n import argparse\n from subprocess import check_call, CalledProcessError\n \n@@ -24,7 +25,7 @@\n     \"\"\"\n     # Delete the branch first\n     try :\n-        check_call(['git', 'pull', '--no-edit', repo, branch])\n+        check_call(['git', 'pull', repo, branch], stdin=io.open(os.devnull))\n     except CalledProcessError :\n         check_call(['git', 'merge', '--abort'])\n         return False\n@@ -57,13 +58,11 @@\n def main(*args):\n     parser = argparse.ArgumentParser(\n             description=\"\"\"\n-                Merge (one|many) github pull request by their number.\\\n-                \n-                If pull request can't be merge as is, cancel merge,\n-                and continue to the next if any.\n+                Merge one or more github pull requests by their number. If any\n+                one pull request can't be merged as is, its merge is ignored\n+                and the process continues with the next ones (if any).\n                 \"\"\"\n             )\n-    parser.add_argument('-v2', '--githubapiv2', action='store_const', const=2)\n \n     grp = parser.add_mutually_exclusive_group()\n     grp.add_argument(\n@@ -77,8 +76,7 @@\n             action='store_const',\n             const=True ,\n             help='try to merge as many PR as possible, one by one')\n-    grp.add_argument('-m',\n-            '--merge',\n+    parser.add_argument('integers',\n             type=int,\n             help=\"The pull request numbers\",\n             nargs='*',\n", "issue": "Unknown option `no-edit` in git-mpr\nThis 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.\n\n```\n(master)longs[ipython]> git mpr -m 2179\nerror: unknown option `no-edit'\nusage: git fetch [<options>] [<repository> [<refspec>...]]\n   or: git fetch [<options>] <group>\n   or: git fetch --multiple [<options>] [(<repository> | <group>)...]\n   or: git fetch --all [<options>]\n\n    -v, --verbose         be more verbose\n    -q, --quiet           be more quiet\n    --all                 fetch from all remotes\n    -a, --append          append to .git/FETCH_HEAD instead of overwriting\n    --upload-pack <path>  path to upload pack on remote end\n    -f, --force           force overwrite of local branch\n    -m, --multiple        fetch from multiple remotes\n    -t, --tags            fetch all tags and associated objects\n    -n                    do not fetch all tags (--no-tags)\n    -p, --prune           prune remote-tracking branches no longer on remote\n    --recurse-submodules[=<on-demand>]\n                          control recursive fetching of submodules\n    --dry-run             dry run\n    -k, --keep            keep downloaded pack\n    -u, --update-head-ok  allow updating of HEAD ref\n    --progress            force progress reporting\n    --depth <depth>       deepen history of shallow clone\n\nfatal: There is no merge to abort (MERGE_HEAD missing).\nTraceback (most recent call last):\n  File \"/home/fperez/usr/bin//git-mpr\", line 117, in <module>\n    main()\n  File \"/home/fperez/usr/bin//git-mpr\", line 107, in main\n    merge_pr(num)\n  File \"/home/fperez/usr/bin//git-mpr\", line 46, in merge_pr\n    branch=branch,\n  File \"/home/fperez/usr/bin//git-mpr\", line 29, in merge_branch\n    check_call(['git', 'merge', '--abort'])\n  File \"/usr/lib/python2.7/subprocess.py\", line 511, in check_call\n    raise CalledProcessError(retcode, cmd)\nsubprocess.CalledProcessError: Command '['git', 'merge', '--abort']' returned non-zero exit status 128\n```\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUsage:\n    python git-mpr.py -m 1657\n\"\"\"\nfrom __future__ import print_function\n\nimport argparse\nfrom subprocess import check_call, CalledProcessError\n\nimport gh_api\n\nipy_repository = 'git://github.com/ipython/ipython.git'\ngh_project = \"ipython/ipython\"\nnot_merged = {}\n\ndef merge_branch(repo, branch ):\n    \"\"\"try to merge the givent branch into the current one\n    \n    If something does not goes smoothly, merge is aborted\n    \n    Returns True if merge sucessfull, False otherwise\n    \"\"\"\n    # Delete the branch first\n    try :\n        check_call(['git', 'pull', '--no-edit', repo, branch])\n    except CalledProcessError :\n        check_call(['git', 'merge', '--abort'])\n        return False\n    return True\n\n\ndef merge_pr(num):\n    \"\"\" try to merge the branch of PR `num` into current branch\n    \"\"\"\n    # Get Github authorisation first, so that the user is prompted straight away\n    # if their login is needed.\n    \n    pr = gh_api.get_pull_request(gh_project, num)\n    repo = pr['head']['repo']['clone_url']\n\n\n    branch = pr['head']['ref']\n    mergeable = merge_branch(repo=repo, \n                 branch=branch,\n              )\n    if not mergeable :\n        cmd = \"git pull \"+repo+\" \"+branch\n        not_merged[str(num)] = cmd\n        print(\"==============================================================================\")\n        print(\"Something went wrong merging this branch, you can try it manually by runngin :\")\n        print(cmd)\n        print(\"==============================================================================\")\n        \n    \ndef main(*args):\n    parser = argparse.ArgumentParser(\n            description=\"\"\"\n                Merge (one|many) github pull request by their number.\\\n                \n                If pull request can't be merge as is, cancel merge,\n                and continue to the next if any.\n                \"\"\"\n            )\n    parser.add_argument('-v2', '--githubapiv2', action='store_const', const=2)\n\n    grp = parser.add_mutually_exclusive_group()\n    grp.add_argument(\n            '-l',\n            '--list',\n            action='store_const',\n            const=True,\n            help='list PR, their number and their mergeability')\n    grp.add_argument('-a',\n            '--merge-all',\n            action='store_const',\n            const=True ,\n            help='try to merge as many PR as possible, one by one')\n    grp.add_argument('-m',\n            '--merge',\n            type=int,\n            help=\"The pull request numbers\",\n            nargs='*',\n            metavar='pr-number')\n    args = parser.parse_args()\n\n    if(args.list):\n        pr_list = gh_api.get_pulls_list(gh_project)\n        for pr in pr_list :\n            mergeable = gh_api.get_pull_request(gh_project, pr['number'])['mergeable']\n\n            ismgb = u\"\u221a\" if mergeable else \" \"\n            print(u\"* #{number} [{ismgb}]:  {title}\".format(\n                number=pr['number'],\n                title=pr['title'],\n                ismgb=ismgb))\n\n    if(args.merge_all):\n        pr_list = gh_api.get_pulls_list(gh_project)\n        for pr in pr_list :\n            merge_pr(pr['number'])\n\n\n    elif args.merge:\n        for num in args.merge :\n            merge_pr(num)\n\n    if not_merged :\n        print('*************************************************************************************')\n        print('the following branch have not been merged automatically, considere doing it by hand :')\n        for num, cmd in not_merged.items() :\n            print( \"PR {num}: {cmd}\".format(num=num, cmd=cmd))\n        print('*************************************************************************************')\n\nif __name__ == '__main__':\n    main()\n", "path": "tools/git-mpr.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nUsage:\n    python git-mpr.py -m 1657\n\"\"\"\nfrom __future__ import print_function\n\nimport io, os\nimport argparse\nfrom subprocess import check_call, CalledProcessError\n\nimport gh_api\n\nipy_repository = 'git://github.com/ipython/ipython.git'\ngh_project = \"ipython/ipython\"\nnot_merged = {}\n\ndef merge_branch(repo, branch ):\n    \"\"\"try to merge the givent branch into the current one\n    \n    If something does not goes smoothly, merge is aborted\n    \n    Returns True if merge sucessfull, False otherwise\n    \"\"\"\n    # Delete the branch first\n    try :\n        check_call(['git', 'pull', repo, branch], stdin=io.open(os.devnull))\n    except CalledProcessError :\n        check_call(['git', 'merge', '--abort'])\n        return False\n    return True\n\n\ndef merge_pr(num):\n    \"\"\" try to merge the branch of PR `num` into current branch\n    \"\"\"\n    # Get Github authorisation first, so that the user is prompted straight away\n    # if their login is needed.\n    \n    pr = gh_api.get_pull_request(gh_project, num)\n    repo = pr['head']['repo']['clone_url']\n\n\n    branch = pr['head']['ref']\n    mergeable = merge_branch(repo=repo, \n                 branch=branch,\n              )\n    if not mergeable :\n        cmd = \"git pull \"+repo+\" \"+branch\n        not_merged[str(num)] = cmd\n        print(\"==============================================================================\")\n        print(\"Something went wrong merging this branch, you can try it manually by runngin :\")\n        print(cmd)\n        print(\"==============================================================================\")\n        \n    \ndef main(*args):\n    parser = argparse.ArgumentParser(\n            description=\"\"\"\n                Merge one or more github pull requests by their number. If any\n                one pull request can't be merged as is, its merge is ignored\n                and the process continues with the next ones (if any).\n                \"\"\"\n            )\n\n    grp = parser.add_mutually_exclusive_group()\n    grp.add_argument(\n            '-l',\n            '--list',\n            action='store_const',\n            const=True,\n            help='list PR, their number and their mergeability')\n    grp.add_argument('-a',\n            '--merge-all',\n            action='store_const',\n            const=True ,\n            help='try to merge as many PR as possible, one by one')\n    parser.add_argument('integers',\n            type=int,\n            help=\"The pull request numbers\",\n            nargs='*',\n            metavar='pr-number')\n    args = parser.parse_args()\n\n    if(args.list):\n        pr_list = gh_api.get_pulls_list(gh_project)\n        for pr in pr_list :\n            mergeable = gh_api.get_pull_request(gh_project, pr['number'])['mergeable']\n\n            ismgb = u\"\u221a\" if mergeable else \" \"\n            print(u\"* #{number} [{ismgb}]:  {title}\".format(\n                number=pr['number'],\n                title=pr['title'],\n                ismgb=ismgb))\n\n    if(args.merge_all):\n        pr_list = gh_api.get_pulls_list(gh_project)\n        for pr in pr_list :\n            merge_pr(pr['number'])\n\n\n    elif args.merge:\n        for num in args.merge :\n            merge_pr(num)\n\n    if not_merged :\n        print('*************************************************************************************')\n        print('the following branch have not been merged automatically, considere doing it by hand :')\n        for num, cmd in not_merged.items() :\n            print( \"PR {num}: {cmd}\".format(num=num, cmd=cmd))\n        print('*************************************************************************************')\n\nif __name__ == '__main__':\n    main()\n", "path": "tools/git-mpr.py"}]}