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

Dan Villiom Podlaski Christiansen danchr at gmail.com
Thu Dec 16 11:14:14 CET 2010


On 16 Dec 2010, at 10:33, Antonio Cuni wrote:

> 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.:
<snip>

I'd suggest parsing the command line output of Mercurial, as it's the  
officially sanctioned stable API for Mercurial. The Python API, while  
faster, provides no stability guarantees. That being said, the  
following will create a repository instance and access the context for  
a particular changeset:

>>> from mercurial import hg, ui
>>>
>>> repo = hg.repository(ui.ui(), 'path/to/repo')
>>> ctx = repo['tip']
>>> log = ctx.description()

The typical accessors for a changeset context are defined at <http://hg.intevation.org/mercurial/file/7397a53219c9/mercurial/context.py#l97 
 >.

Please note that any use of the Python API means that the entire  
application is covered by the GPL.

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20101216/1fd877d1/attachment.bin>


More information about the Pypy-dev mailing list