[ANNOUNCE] hg "shell" extension

Mark Williamson mark.williamson at cl.cam.ac.uk
Tue Feb 5 20:12:06 CST 2008


Steve,

I think this would do what we want:
http://docs.python.org/lib/Cmd-objects.html

It avoids having a compulsory readline module at all and thus should make the 
hg shell properly cross platform.  I can have a go at refactoring it into 
this form if you think it would be useful to you?

It's getting to the point where the shell's intelligent completion does most 
of the things that seemed a good idea to me, so if anyone has any suggestions 
for things they wished were possible, then please let me know ;-)

Cheers,
Mark

On Tuesday 05 February 2008, Steve Borho wrote:
> On Tue, 2008-02-05 at 18:14 +0000, Mark Williamson wrote:
> > > > I'm not aware of anything like this having been done before but maybe
> > > > I just missed it.  For some reason I've decided it'd be "fun" to dive
> > > > into playing with Python's readline interface and hacked up a
> > > > prototype interactive Hg shell.
> > > >
> > > > The attached patch is a snapshot of how far I've gotten.  It applies
> > > > with -p0 and adds a file "shell.py" to the hgext directory.  There
> > > > are no other changes to the hg source.
> > > >
> > > > The "shell" extension implements an interactive commandline for hg,
> > > > supporting editting, history and tab completion on command names,
> > > > command options and global opions.  It should work on Unix systems,
> > > > but I believe not on Windows (which lacks a Python readline module,
> > > > apparently).
> > > >
> > > > The tab completion isn't yet as intelligent as it could be, since it
> > > > doesn't understand which options should also have arguments and it's
> > > > not able to complete filenames or revision IDs.  I'll hope to add
> > > > these features in a future release
> > >
> > > The zsh completion script has pretty comprehensive context-sensitive
> > > tab completion. I think the bash one is also pretty good, though I
> > > haven't used it. Given that, the shell extension is probably best
> > > suited for windows (or csh users and other inhabitants of purgatory).
> >
> > Thanks for the info!
> >
> > I'll give those completion scripts a playing with...  I would hope that a
> > true hg extension for shell-like behaviour ought to be able to perform
> > better than an external shell completion script and offer more-cunning
> > behaviours, but I could be wrong here.
> >
> > This is quite fun stuff to play with though, so I'll be working on it
> > regardless (and I need it for pmpu future developments).
> >
> > My current development code has much better context-sensitive
> > intelligence, things are coming along nice and quickly.
>
> It would definitely be a boon to be able to embed an hg-shell into
> TortoiseHg.  Any chance you could get it to work with this package?
>
> http://newcenturycomputers.net/projects/readline.html



-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)


More information about the Mercurial mailing list