This is an archive of the discontinued Mercurial Phabricator instance.

debugshell: add a simple command for starting an interactive shell
ClosedPublic

Authored by joerg.sonnenberger on Jan 25 2021, 6:19 PM.

Details

Summary

This simplifies interactive exploration of the Mercurial APIs.
The ui and repo instances are provided as local variables.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Ultimately I'd like to add support for a -m to be able to pip install --user. I assume there's a way to do that with the code module?

As mentioned in IRC, -c ... can be done with echoing into this command. I'll have to look at some of my setup script stuff, but I think it might be nice to have -c that doesn't print all of the REPL banner stuff because keyring on Linux usually requires running some python commands to print where various files are stored. But that's all future stuff. I'm happy with this once the optional repo question is answered/fixed. (Also, this needs hg fix.)

mercurial/debugcommands.py
3721

Should repo be optional? It's somewhat less useful that way, but it's valid to run some commands with no repo, so it might be worth the ability to poke around at the internals in that state.

Note that once D9872 is in, I'll loby for this comand to be name admin::python

joerg.sonnenberger marked an inline comment as done.Jan 26 2021, 11:05 AM

Actually, I believe this really belongs into a/the debug namespace, not admin. It's a much lower level than all other tools and not a user interface in any form.

mharbison72 accepted this revision.Jan 27 2021, 12:26 AM
This revision is now accepted and ready to land.Jan 27 2021, 12:26 AM
pulkit added a subscriber: pulkit.Jan 27 2021, 5:27 AM

Can you followup by removing the debugshell in contrib/ then? https://www.mercurial-scm.org/repo/hg/file/tip/contrib/debugshell.py