[PATCH 3 of 3] revlog: support reading general deltas
Sune Foldager
cryo at cyanite.org
Wed May 4 16:42:09 CDT 2011
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1304544568 -7200
# Node ID 7f2e8ed280a6b1c272ec080fd2ca2315a0d264e7
# Parent 39f6e0127ff15c5ad82b989d387402ec83ea30d4
revlog: support reading general deltas
Parentdelta (per entry) takes precedence over generaldelta (per revlog).
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -28,10 +28,11 @@
REVLOGNG = 1
REVLOGNGINLINEDATA = (1 << 16)
REVLOGSHALLOW = (1 << 17)
+REVLOG_GENERALDELTA = (1 << 18)
REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
REVLOG_DEFAULT_FORMAT = REVLOGNG
REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
-REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW
+REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW | REVLOG_GENERALDELTA
# revlog index flags
REVIDX_PARENTDELTA = 1
@@ -253,6 +254,7 @@
self.version = v
self._inline = v & REVLOGNGINLINEDATA
self._shallow = v & REVLOGSHALLOW
+ self._generaldelta = v & REVLOG_GENERALDELTA
flags = v & ~0xFFFF
fmt = v & 0xFFFF
if fmt == REVLOGV0 and flags:
@@ -841,6 +843,8 @@
def _deltaparent(self, rev):
if self.flags(rev) & REVIDX_PARENTDELTA:
return self.parentrevs(rev)[0]
+ elif self._generaldelta:
+ return self.index[rev][3]
else:
return rev - 1
More information about the Mercurial-devel
mailing list