official python interface for mercurial
Chad Dombrova
chadrik at gmail.com
Tue May 25 21:45:09 UTC 2010
>
>
> We are usually open to cleanups, refactoring, etc. (if they are
> sensible they should help core-hg too)
>
ok, i've taken a shot at refactoring mercurial and adding an entry point for
pure-python apps like tortoise.
http://www.bitbucket.org/chadrik/hg-patches/src/tip/dispatch_localize.patch
http://www.bitbucket.org/chadrik/hg-patches/src/tip/dispatch_bootstrap.patch
http://www.bitbucket.org/chadrik/hg-patches/src/tip/dispatch_globalopts.patch
http://www.bitbucket.org/chadrik/hg-patches/src/tip/dispatch_cmdrepo.patch
http://www.bitbucket.org/chadrik/hg-patches/src/tip/dispatch_pydispatch.patch
i ran my patches by the tortoise developers and made some changes based on
their feedback. they were in the middle of making a utility like this for
their own purposes, but as we were discussing here before, it's best for all
if there is an official mercurial api for this.
the end goal is to be able to have an exact python equivalent to _dispatch,
so you can do the following:
from mercurial import ui, dispatch
dispatch.pydispatch(ui.ui(), 'tag', 'v1.1', force=True, user='chad')
like _dispatch, this checks arguments, does full bootstrapping (read local
.hgrc, load extensions, set global options), and runs pre- and post- hooks.
for persistent apps which only want to bootstrap once, there's an alternate
entry point:
dispatch.pyruncommand(ui.ui(), 'tag', 'v1.1', force=True, user='chad')
i'd be glad to send a patchbomb to anyone who wants one.
-chad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20100525/fe835ea4/attachment.html>
More information about the Mercurial
mailing list