[PATCH 3 of 6] revlog: add support for 'original text' to addrevision and addgroup
Sune Foldager
cryo at cyanite.org
Mon Feb 7 05:29:36 CST 2011
On 01-02-2011 00:43, Matt Mackall wrote:
> On Mon, 2011-01-31 at 11:21 +0100, Sune Foldager wrote:
>> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
>> --- a/mercurial/revlog.py
>> +++ b/mercurial/revlog.py
>> @@ -923,7 +923,8 @@
>> tr.replace(self.indexfile, trindex * self._io.size)
>> self._chunkclear()
>>
>> - def addrevision(self, text, transaction, link, p1, p2, cachedelta=None):
>> + def addrevision(self, text, transaction, link, p1, p2, cachedelta=None,
>> + origtext=None):
>
> I think this is not the ideal interface.
Me neither.. I don't really like it too much.
> This appears to be motivated by the need to calculate the hash based on
> the known text. But wouldn't it be better to factor out hash calculation
> (already done!), then have filelog pass the hash in?
Unfortunately, the origtext is also needed for caching purposes (in
_addrevision), unless we, e.g., were to decide to not cache when this
feature is invoked. I am not sure about the implications of doing that
right now. Ideas?
> This has other benefits. For instance, in the wire protocol, we already
> know the hash of deltas we're adding and can thus avoid recalculating
> them.
Yes, I think it would be cleaner. Not sure it'll be enough, though.
-Sune
More information about the Mercurial-devel
mailing list