[pypy-dev] speed.pypy.org and mercurial

Antonio Cuni anto.cuni at gmail.com
Thu Dec 16 10:33:09 CET 2010

Hi Miquel,

On 16/12/10 09:29, Miquel Torres wrote:
> Hi Anto,
> yes, that is expected, but no problem. Codespeed is designed in such a
> way that it can support different version control systems. It is just
> that there is only support for svn now ;-)
> So for mercurial support, I need to implement a function that takes a
> changeset hash, connects to the hg repo and returns a dict with
> 'date', 'user' and 'description' or 'summary' info. Anybody knows what
> library I could use for that? or do I have to parse local 'hg log'
> output?

I think you have several options to do that. For the particular pypy case,
maybe the simplest is to directly ask bitbucket for the changeset:

this has the advantage that you don't need any library but just an http
request, but of course it works only for bitbucket repos.

Alternatively, if you install mercurial you can then "import
mercurial.commands" and use its public API from Python. Or as you said you can
just execute hg log and parse the output: in this case you might be interested
in the --template option, which allows you to format things exactly as you
want, e.g.:

$ hg log -r c55286db0781 --template '{author}\n{date|isodate}\n{desc}\n'
Armin Rigo <arigo at tunes.org>
2010-12-16 10:01 +0100
Document this publicly.

see this page for more details:


More information about the Pypy-dev mailing list