mercurial/dispatch.py
changeset 30576 541949a10a68
parent 30559 d83ca854fa21
child 30586 2d555d753f0e
equal deleted inserted replaced
30575:5ffbaba9acac 30576:541949a10a68
     8 from __future__ import absolute_import, print_function
     8 from __future__ import absolute_import, print_function
     9 
     9 
    10 import atexit
    10 import atexit
    11 import difflib
    11 import difflib
    12 import errno
    12 import errno
       
    13 import getopt
    13 import os
    14 import os
    14 import pdb
    15 import pdb
    15 import re
    16 import re
    16 import shlex
    17 import shlex
    17 import signal
    18 import signal
   446     options = {}
   447     options = {}
   447     cmdoptions = {}
   448     cmdoptions = {}
   448 
   449 
   449     try:
   450     try:
   450         args = fancyopts.fancyopts(args, commands.globalopts, options)
   451         args = fancyopts.fancyopts(args, commands.globalopts, options)
   451     except fancyopts.getopt.GetoptError as inst:
   452     except getopt.GetoptError as inst:
   452         raise error.CommandError(None, inst)
   453         raise error.CommandError(None, inst)
   453 
   454 
   454     if args:
   455     if args:
   455         cmd, args = args[0], args[1:]
   456         cmd, args = args[0], args[1:]
   456         aliases, entry = cmdutil.findcmd(cmd, commands.table,
   457         aliases, entry = cmdutil.findcmd(cmd, commands.table,
   469     for o in commands.globalopts:
   470     for o in commands.globalopts:
   470         c.append((o[0], o[1], options[o[1]], o[3]))
   471         c.append((o[0], o[1], options[o[1]], o[3]))
   471 
   472 
   472     try:
   473     try:
   473         args = fancyopts.fancyopts(args, c, cmdoptions, gnu=True)
   474         args = fancyopts.fancyopts(args, c, cmdoptions, gnu=True)
   474     except fancyopts.getopt.GetoptError as inst:
   475     except getopt.GetoptError as inst:
   475         raise error.CommandError(cmd, inst)
   476         raise error.CommandError(cmd, inst)
   476 
   477 
   477     # separate global options back out
   478     # separate global options back out
   478     for o in commands.globalopts:
   479     for o in commands.globalopts:
   479         n = o[1]
   480         n = o[1]
   599     """Return the function to run the shell alias, if it is required"""
   600     """Return the function to run the shell alias, if it is required"""
   600     options = {}
   601     options = {}
   601 
   602 
   602     try:
   603     try:
   603         args = fancyopts.fancyopts(args, commands.globalopts, options)
   604         args = fancyopts.fancyopts(args, commands.globalopts, options)
   604     except fancyopts.getopt.GetoptError:
   605     except getopt.GetoptError:
   605         return
   606         return
   606 
   607 
   607     if not args:
   608     if not args:
   608         return
   609         return
   609 
   610