contrib/perf.py
changeset 36178 646002338365
parent 35951 8b6dd3922f70
child 36359 df3f7f00a3fc
equal deleted inserted replaced
36177:187f2474bc11 36178:646002338365
    62     pass
    62     pass
    63 try:
    63 try:
    64     from mercurial import scmutil # since 1.9 (or 8b252e826c68)
    64     from mercurial import scmutil # since 1.9 (or 8b252e826c68)
    65 except ImportError:
    65 except ImportError:
    66     pass
    66     pass
       
    67 try:
       
    68     from mercurial import pycompat
       
    69     getargspec = pycompat.getargspec  # added to module after 4.5
       
    70 except (ImportError, AttributeError):
       
    71     import inspect
       
    72     getargspec = inspect.getargspec
    67 
    73 
    68 # for "historical portability":
    74 # for "historical portability":
    69 # define util.safehasattr forcibly, because util.safehasattr has been
    75 # define util.safehasattr forcibly, because util.safehasattr has been
    70 # available since 1.9.3 (or 94b200a11cf7)
    76 # available since 1.9.3 (or 94b200a11cf7)
    71 _undefined = object()
    77 _undefined = object()
   112     return cmd.lstrip("^").split("|")
   118     return cmd.lstrip("^").split("|")
   113 
   119 
   114 if safehasattr(registrar, 'command'):
   120 if safehasattr(registrar, 'command'):
   115     command = registrar.command(cmdtable)
   121     command = registrar.command(cmdtable)
   116 elif safehasattr(cmdutil, 'command'):
   122 elif safehasattr(cmdutil, 'command'):
   117     import inspect
       
   118     command = cmdutil.command(cmdtable)
   123     command = cmdutil.command(cmdtable)
   119     if 'norepo' not in inspect.getargspec(command)[0]:
   124     if 'norepo' not in getargspec(command).args:
   120         # for "historical portability":
   125         # for "historical portability":
   121         # wrap original cmdutil.command, because "norepo" option has
   126         # wrap original cmdutil.command, because "norepo" option has
   122         # been available since 3.1 (or 75a96326cecb)
   127         # been available since 3.1 (or 75a96326cecb)
   123         _command = command
   128         _command = command
   124         def command(name, options=(), synopsis=None, norepo=False):
   129         def command(name, options=(), synopsis=None, norepo=False):