Possible bug in Internal Python API

Dirkjan Ochtman dirkjan at ochtman.nl
Fri Aug 13 11:38:44 UTC 2010


On Fri, Aug 13, 2010 at 13:21, Miguel Araujo <muchochini at gmail.com> wrote:
> I'm not going to lie. This is the first time I use it, and I think the API
> documentation at  http://mercurial.selenic.com/wiki/MercurialApi is quite
> poor. I read it all and there are a lot of things not explained, the
> internal methods of many modules don't even have doc strings, so it forces
> you to read the code.

Well, I wouldn't say they are poor in the sense that they're
incorrect, but I would agree that they're not really extensive.

Be aware that our API is also always in flux. If you want a stable
API, your best bet is scripting the command line (or maybe calling
functions in the commands module, which map directly to commands).

>> This is silly code, context.changectx()'s first argument must be a
>> repository, not a string (which is what you're passing here). I'm
>> pretty sure this doesn't work on your laptop, either.
>
> Trust me, this works flawlessly. I'm sending a screenshot attached so you
> can see I don't lie.

I'm not seeing any screenshot. :)

>> Also check out the MercurialApi wiki page for nice API usage patterns
>> (such as using repo['tip'] to get a changectx).
>
> Thanks, I have read all the docs I have found, which as I have said, are not
> many in my humble opinion. The repo['tip'] pattern does not appear in the
> wiki like that.

Right, there aren't many docs. Still, if you start looking at commands
code to see what they do, the patterns should become obvious. It would
probably also help if you studied documentation not just on the API,
but also the underlying data model (and usage of the tool).

> Problem is repo that returns 21 and the one that returns 43, are exactly the
> same one. Directories don't differ a single bit.

How did you check? What does hg parents say?

Cheers,

Dirkjan



More information about the Mercurial-devel mailing list