Possible bug in Internal Python API
Miguel Araujo
muchochini at gmail.com
Fri Aug 13 11:25:23 UTC 2010
Sorry,
I forgot to attach the mentioned screenshot. There it goes.
Cheers,
Miguel Araujo
2010/8/13 Miguel Araujo <muchochini at gmail.com>
> First thank you Dirkjan Ochtman and Vishakh Harikumar for your fast
> answers,
>
> I want to clarify that of course I had read the API documentation before
> sending this email. The fact that my code works in one machine and It
> doesn't in other, made
> me wonder if it was a bug. I still think there are some details that you
> can not explain, so there still could be a flaw in the code.
>
> It looks like you don't really understand Mercurial's data model or the
>> API...
>
>
> 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.
>
> This is because the repo on your server doesn't have a working
>> directory checked out. Getting a changectx() by default gets you the
>> revision the working directory is at (so not necessarily the last
>> revision in the repository!).
>
>
> I didn't know this, thanks.
>
> 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 would advise you to read some more docs and familiarize yourself
>> with Mercurial some more before you try to write code against it.
>>
>> 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.
> *
> *
>
>> The revision numbers you see probably correspond to those of the working
>> directory. repository supports repo[changeid] to get a changectx, so you
>> want repo['tip'] for the tip of the repo.
>
>
> Problem is repo that returns 21 and the one that returns 43, are exactly
> the same one. Directories don't differ a single bit.
>
>
>> it should be changectx(repository, repository.changelog.tip()).
>> repo['tip'] is better
>>
>>
> repo['tip'] does work in both machines. Thanks for the correction.
>
> Well, I'm just reporting this, because I think it could help, best regards
> Miguel Araujo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100813/41bac9dd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mercurial-ipython.png
Type: image/png
Size: 31742 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100813/41bac9dd/attachment.png>
More information about the Mercurial-devel
mailing list