[PATCH 01 of 12] Add OVERLAY flag to revlog

Brendan Cully brendan at kublai.com
Tue Jan 2 15:42:13 CST 2007


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1167777076 18000
# Node ID 0ececd8212ea7acd43accf4fbdee8a5ca64ea0e0
# Parent  20da40cc1c7331d759a8fd068d0769dc6af0b33d
Add OVERLAY flag to revlog.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -21,6 +21,7 @@ REVLOGNG = 1
 
 # revlog flags
 REVLOGNGINLINEDATA = (1 << 16)
+REVLOGNGOVERLAY = (1 << 17)
 REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
 
 REVLOG_DEFAULT_FORMAT = REVLOGNG
@@ -358,7 +359,7 @@ class revlog(object):
                 raise RevlogError(_("index %s unknown flags %#04x for format v0")
                                   % (self.indexfile, flags >> 16))
         elif fmt == REVLOGNG:
-            if flags & ~REVLOGNGINLINEDATA:
+            if flags & ~(REVLOGNGINLINEDATA | REVLOGNGOVERLAY):
                 raise RevlogError(_("index %s unknown flags %#04x for revlogng")
                                   % (self.indexfile, flags >> 16))
         else:
@@ -385,6 +386,8 @@ class revlog(object):
                 e = list(self.index[0])
                 type = self.ngtype(e[0])
                 e[0] = self.offset_type(0, type)
+                if flags & REVLOGNGOVERLAY:
+                    self.startrev = self.base(0)
                 self.index[0] = e
         else:
             self.nodemap = {nullid: nullrev}
@@ -464,6 +467,7 @@ class revlog(object):
             self.nodemap = self.nodemap.p.map
 
     def inlinedata(self): return self.version & REVLOGNGINLINEDATA
+    def overlay(self): return self.version & REVLOGNGOVERLAY
     def tip(self): return self.node(len(self.index) - 1)
     def count(self): return len(self.index)
     def node(self, rev):


More information about the Mercurial-devel mailing list