[PATCH 1 of 3] keyword: use dirstate.parents to obtain current first parent
Christian Ebert
blacktrash at gmx.net
Thu Jun 12 09:08:48 UTC 2008
* Matt Mackall on Thursday, June 12, 2008 at 02:41:50 -0500
> On Thu, 2008-06-12 at 08:39 +0200, Christian Ebert wrote:
>> * Matt Mackall on Wednesday, June 11, 2008 at 23:39:58 -0500
>>> On Thu, 2008-06-12 at 03:28 +0200, Christian Ebert wrote:
>>>> This should be quicker than changectx().node()
>>
>> [...]
>>
>>>> - elif node1 is not None and node1 != repo.changectx().node():
>>>> + elif node1 is not None and node1 != repo.dirstate.parents()[0]:
>>>
>>> Really? You're right,
>>
>> phew
>>
>>> it is about 5 times faster. But it's a difference between 2us
>>> and 10us here. Unless this is in a loop, it's never going to
>>> show up in a profile.
>>
>> Sure. Just trying to make the extension's footprint as small as possible.
>
> Unfortunately, I think this is a step in the wrong direction. But only a
> minor one. This operation is very common and I'd like to see this
> operation get simpler, not more complicated. It should go from:
>
> repo.dirstate.parents()[0]
>
> to perhaps something like:
>
> repo.parent1() # maybe this takes an optional node arg
>
> Or maybe we add a [] method to repo to get a context, so this becomes:
>
> repo["."].node()
>
> We should move away from people having to know about dirstates, and just
> work with contexts.
I like the whole context thingie. Actually I used a context in
the first place because the concept is more obvious. Then again,
as I happened to look into bail_if_changed again, I decided that
at that specific point I was also only interested in the dirstate
in the true sense of the word. Which is why I proposed the small
change. But I'm completely fine with waiting for a slimmer
context interface.
I resend the patch concerning annotate standalone, as its change
in behaviour really makes sense imho.
c
--
Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]
_F R E E_ _V I D E O S_ -->> http://www.blacktrash.org/underdogma/
More information about the Mercurial-devel
mailing list