##// END OF EJS Templates
debugshell: allow commands to be specified as a CLI argument...
Arun Kulshreshtha -
r50839:8f76a41e default
parent child Browse files
Show More
@@ -3786,8 +3786,21 b' def debugsub(ui, repo, rev=None):'
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
@@ -3815,6 +3828,12 b' def debugshell(ui, repo):'
3815 except ImportError:
3828 except ImportError:
3816 site = None # Keep PyCharm happy
3829 site = None # Keep PyCharm happy
3817
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
3836
3818 code.interact(local=imported_objects)
3837 code.interact(local=imported_objects)
3819
3838
3820
3839
@@ -328,7 +328,7 b' Show all commands + options'
328 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
328 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
329 debugserve: sshstdio, logiofd, logiofile
329 debugserve: sshstdio, logiofd, logiofile
330 debugsetparents:
330 debugsetparents:
331 debugshell:
331 debugshell: command
332 debugsidedata: changelog, manifest, dir
332 debugsidedata: changelog, manifest, dir
333 debugssl:
333 debugssl:
334 debugstrip: rev, force, no-backup, nobackup, , keep, bookmark, soft
334 debugstrip: rev, force, no-backup, nobackup, , keep, bookmark, soft
@@ -724,3 +724,8 b' Test debugpeer'
724 pushable: yes
724 pushable: yes
725
725
726 #endif
726 #endif
727
728 Test debugshell
729
730 $ hg debugshell -c 'ui.write(b"%s\n" % ui.username())'
731 test
General Comments 0
You need to be logged in to leave comments. Login now