[PATCH] revlog: allow custom nodeids in subclasses
Matt Mackall
mpm at selenic.com
Thu Aug 15 15:29:24 CDT 2013
On Wed, 2013-08-14 at 09:53 -0700, Wojciech Lopata wrote:
> # HG changeset patch
> # User Wojciech Lopata <lopek at fb.com>
> # Date 1376497815 25200
> # Wed Aug 14 09:30:15 2013 -0700
> # Node ID 1e1e57b10f2a1927781408b8c01ab84dc84e8d3f
> # Parent df54cc67b91bea97c4fc299241a67aeecf099d00
> revlog: allow custom nodeids in subclasses
>
> Modify revlog class to allow its subclasses to use custom method of computing
> nodeids. In particular this change is necesary to implement manifest
> compression.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> old mode 100644
> new mode 100755
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -943,11 +943,15 @@
>
> def _checkhash(self, text, node, rev):
> p1, p2 = self.parents(node)
> - if node != hash(text, p1, p2):
> + if not self._ishashcorrect(text, p1, p2, node):
> raise RevlogError(_("integrity check failed on %s:%d")
> % (self.indexfile, rev))
Let's move the raise inside the method. Then the method can be renamed
to checkhash, with no return code.
> - def addrevision(self, text, transaction, link, p1, p2, cachedelta=None):
> + def addrevision(self, text, transaction, link, p1, p2, cachedelta=None,
> + node=None):
Separate patch, please.
> + if not self._ishashcorrect(btext[0], p1, p2, node):
> raise RevlogError(_("consistency error in delta"))
You'll note this message is less informative than the earlier one.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list