Mercurial API -- "debug"
Matt Mackall
mpm at selenic.com
Mon Jun 14 21:39:52 UTC 2010
On Mon, 2010-06-14 at 16:20 -0500, David Dyer-Bennet wrote:
> The Wiki docs on the Mercurial API seem rather thin. Am I missing the
> preferred data source? Or is this one of those situations where I'm
> supposed to directly read the source? I'm used to an API being
> documented.
Whoever said you ought to write a hook in Python using Mercurial's API
was not giving you the best advice in my opinion. The API is not
'public' in the sense that it's neither stable or documented. Nor should
it be necessary for typical hook uses.
> How can I tell (specifically, in python code being run internally as a
> hook) whether the user specified --debug?
Test ui.debugflag.
> (I'm successfully iterating through a list of the files in the changeset
> being created by a commit, though, that's nice! This does indeed get
> around the problem I noticed last week with parsing filenames produced by
> hg log -r <node> --template etc. that contained spaces (including in
> directory names)).
There's a chapter in the book about templating that explains how to deal
with file lists:
http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html
Search for "listing files on multiple lines". I'm planning to revamp the
templating engine soon so that this will become something like:
hg log --template "changeset {rev}:\n{map(' {file}\n', files)}"
with no need for a style map.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list