Patchwork D9866: debugshell: add a simple command for starting an interactive shell

login
register
mail settings
Submitter phabricator
Date Jan. 25, 2021, 11:20 p.m.
Message ID <differential-rev-PHID-DREV-r4u3kh4d3aa2jjou5t3y-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48177/
State Superseded
Headers show

Comments

phabricator - Jan. 25, 2021, 11:20 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

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

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9866

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3717,6 +3717,15 @@ 
         ui.writenoi18n(b' revision %s\n' % v[1])
 
 
+@command(b'debugshell')
+def debugshell(ui, repo):
+    import code
+    imported_objects = {
+        'ui': ui,
+        'repo': repo,
+    }
+    code.interact(local=imported_objects)
+
 @command(
     b'debugsuccessorssets',
     [(b'', b'closest', False, _(b'return closest successors sets only'))],