mercurial/debugcommands.py
changeset 49944 8f76a41ee465
parent 49896 88b81dc2d82b
child 49999 637d46c5b1fa
equal deleted inserted replaced
49940:86958104b6ca 49944:8f76a41ee465
  3784         ui.writenoi18n(b'path %s\n' % k)
  3784         ui.writenoi18n(b'path %s\n' % k)
  3785         ui.writenoi18n(b' source   %s\n' % v[0])
  3785         ui.writenoi18n(b' source   %s\n' % v[0])
  3786         ui.writenoi18n(b' revision %s\n' % v[1])
  3786         ui.writenoi18n(b' revision %s\n' % v[1])
  3787 
  3787 
  3788 
  3788 
  3789 @command(b'debugshell', optionalrepo=True)
  3789 @command(
  3790 def debugshell(ui, repo):
  3790     b'debugshell',
       
  3791     [
       
  3792         (
       
  3793             b'c',
       
  3794             b'command',
       
  3795             b'',
       
  3796             _(b'program passed in as a string'),
       
  3797             _(b'COMMAND'),
       
  3798         )
       
  3799     ],
       
  3800     _(b'[-c COMMAND]'),
       
  3801     optionalrepo=True,
       
  3802 )
       
  3803 def debugshell(ui, repo, **opts):
  3791     """run an interactive Python interpreter
  3804     """run an interactive Python interpreter
  3792 
  3805 
  3793     The local namespace is provided with a reference to the ui and
  3806     The local namespace is provided with a reference to the ui and
  3794     the repo instance (if available).
  3807     the repo instance (if available).
  3795     """
  3808     """
  3812             site.setcopyright()
  3825             site.setcopyright()
  3813             site.sethelper()
  3826             site.sethelper()
  3814             site.setquit()
  3827             site.setquit()
  3815         except ImportError:
  3828         except ImportError:
  3816             site = None  # Keep PyCharm happy
  3829             site = None  # Keep PyCharm happy
       
  3830 
       
  3831     command = opts.get('command')
       
  3832     if command:
       
  3833         compiled = code.compile_command(encoding.strfromlocal(command))
       
  3834         code.InteractiveInterpreter(locals=imported_objects).runcode(compiled)
       
  3835         return
  3817 
  3836 
  3818     code.interact(local=imported_objects)
  3837     code.interact(local=imported_objects)
  3819 
  3838 
  3820 
  3839 
  3821 @command(
  3840 @command(