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
[email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to