[PATCH 01 of 15] revlog: add flags for parentdelta
Gilles Moris
gilles.moris at free.fr
Mon Jul 12 08:54:11 CDT 2010
On Monday 12 July 2010 12:49:43 pm Pradeepkumar Gayam wrote:
> # HG changeset patch
> # User Pradeepkumar Gayam <in3xes at gmail.com>
> # Date 1278873979 -19800
> # Branch stable
> # Node ID 3dce03cd1a40cfc48a4de05c091fc8da277aa6c4
> # Parent 239f3210c970615dc1d5f861a92b61b4662a71a5
> revlog: add flags for parentdelta
>
> diff -r 239f3210c970 -r 3dce03cd1a40 mercurial/revlog.py
> --- a/mercurial/revlog.py Thu Jul 01 19:13:23 2010 -0500
> +++ b/mercurial/revlog.py Mon Jul 12 00:16:19 2010 +0530
> @@ -30,6 +30,7 @@
> REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
> REVLOG_DEFAULT_FORMAT = REVLOGNG
> REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
> +REVLOG_PARENTDELTA_FLAGS = 1
This should be folded with Patch 6 which renames the flag.
>
> # amount of data read unconditionally, should be >= 4
> # when not inline: threshold for using lazy index
> @@ -1004,6 +1005,9 @@
> return mdiff.textdiff(self.revision(self.node(rev1)),
> self.revision(self.node(rev2)))
>
> + def flags(self, rev):
> + return gettype(self.index[rev][0])
> +
> def revision(self, node):
> """return an uncompressed revision of a given node"""
> if node == nullid:
> @@ -1017,9 +1021,9 @@
> base = self.base(rev)
>
> # check rev flags
> - if self.index[rev][0] & 0xFFFF:
> + if self.flags(rev) & ~REVLOG_PARENTDELTA_FLGAS:
Typo '..._FLAGS'., but anyway pointless because of the rename at patch 6
> raise RevlogError(_('incompatible revision flag %x') %
> - (self.index[rev][0] & 0xFFFF))
> + (self.flags(rev)))
>
> # do we have useful data cached?
> if self._cache and self._cache[1] >= base and self._cache[1] <
> rev: @@ -1109,6 +1113,7 @@
> prev = curr - 1
> base = self.base(prev)
> offset = self.end(prev)
> + flags = 0
>
> if curr:
> if not d:
> @@ -1125,7 +1130,7 @@
> l = len(data[1]) + len(data[0])
> base = curr
>
> - e = (offset_type(offset, 0), l, len(text),
> + e = (offset_type(offset, flags), l, len(text),
> base, link, self.rev(p1), self.rev(p2), node)
> self.index.insert(-1, e)
> self.nodemap[node] = curr
Not sure the last 2 hunks improve the clarity of the code.
Moreover, not directly linked with the patch addition.
Regards.
Gilles.
More information about the Mercurial-devel
mailing list