ANN: __hg_ps1
Greg Ward
greg-hg at gerg.ca
Thu Apr 16 11:16:19 CDT 2009
On Thu, Apr 16, 2009 at 10:31 AM, Kevin Bullock
<kbullock+mercurial at ringworld.org> wrote:
> Heh, and I just saw the thread about vcprompt. Cloning it now to poke
> at it :)
Oh good! The goal of vcprompt is to be as lightweight as possible.
Never mind counting how many processes or Python interpreters I start;
I was counting system calls. Certainly for the initial phase, "am I
even in a VC working dir, and if so is it CVS, Git, Mercurial, ...?"
that kind of paranoia is justified.
Now, the nice thing about CVS, Git, and Mercurial is that it's easy to
figure out the current branch right in C without forking processes or
linking in giant libraries (e.g. Subversion or Python). So that's
what vcprompt does. (Still counting system calls.)
But then I ran out of weekend. There are lots of directions to go
with vcprompt:
* svn/bzr support (in particular, can one write easy C code that
determines the current branch)
* look for "local mods" (print +), unknown files (print ?),
unresolved conflicts (!)
The latter will definitely require either forking (CVS, git),
embedding Python (hg/bzr), or linking/loading the Subversion client
API. So it should only be done if you're definitely in a working dir,
and only for the right VC system. And the result should probably be
cached for 5-30 seconds.
Greg
More information about the Mercurial
mailing list