[PATCH 3 of 6] revlog: add support for 'original text' to addrevision and addgroup
Matt Mackall
mpm at selenic.com
Mon Feb 7 13:24:14 CST 2011
On Mon, 2011-02-07 at 12:29 +0100, Sune Foldager wrote:
> 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?
Actually, that's trivial to work around - just have filelog update the
cache itself.
We also we want origtext for storing a proper length. But as it turns
out, this has long been slightly broken for renamed revisions.
What's most ugly here is passing in the text -three- different ways
(text, origtext, cachedelta). It seems like we should be able to break
this into a few layers, but I'm not sure how yet.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list