Replaced 0 with REVLOGV0 where this meaning is used.
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 27 Apr 2006 21:16:46 +0200
changeset 2142 8a1e2a9c7013
parent 2141 ed631e83fa06
child 2143 3053fc33f545
Replaced 0 with REVLOGV0 where this meaning is used.
mercurial/changelog.py
mercurial/localrepo.py
mercurial/manifest.py
mercurial/revlog.py
--- a/mercurial/changelog.py	Thu Apr 27 21:03:07 2006 +0200
+++ b/mercurial/changelog.py	Thu Apr 27 21:16:46 2006 +0200
@@ -11,7 +11,7 @@
 demandload(globals(), "os time util")
 
 class changelog(revlog):
-    def __init__(self, opener, defversion=0):
+    def __init__(self, opener, defversion=REVLOGV0):
         revlog.__init__(self, opener, "00changelog.i", "00changelog.d",
                         defversion)
 
--- a/mercurial/localrepo.py	Thu Apr 27 21:03:07 2006 +0200
+++ b/mercurial/localrepo.py	Thu Apr 27 21:16:46 2006 +0200
@@ -42,7 +42,7 @@
             pass
 
         v = self.ui.revlogopts
-        self.revlogversion = int(v.get('format', 0))
+        self.revlogversion = int(v.get('format', revlog.REVLOGV0))
         flags = 0
         for x in v.get('flags', "").split():
             flags |= revlog.flagstr(x)
--- a/mercurial/manifest.py	Thu Apr 27 21:03:07 2006 +0200
+++ b/mercurial/manifest.py	Thu Apr 27 21:16:46 2006 +0200
@@ -12,7 +12,7 @@
 demandload(globals(), "bisect array")
 
 class manifest(revlog):
-    def __init__(self, opener, defversion=0):
+    def __init__(self, opener, defversion=REVLOGV0):
         self.mapcache = None
         self.listcache = None
         revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
--- a/mercurial/revlog.py	Thu Apr 27 21:03:07 2006 +0200
+++ b/mercurial/revlog.py	Thu Apr 27 21:16:46 2006 +0200
@@ -293,7 +293,7 @@
     remove data, and can use some simple techniques to avoid the need
     for locking while reading.
     """
-    def __init__(self, opener, indexfile, datafile, defversion=0):
+    def __init__(self, opener, indexfile, datafile, defversion=REVLOGV0):
         """
         create a revlog object
 
@@ -337,7 +337,7 @@
                 v = struct.unpack(versionformat, i)[0]
         flags = v & ~0xFFFF
         fmt = v & 0xFFFF
-        if fmt == 0:
+        if fmt == REVLOGV0:
             if flags:
                 raise RevlogError(_("index %s invalid flags %x for format v0" %
                                    (self.indexfile, flags)))
@@ -349,7 +349,7 @@
             raise RevlogError(_("index %s invalid format %d" %
                                (self.indexfile, fmt)))
         self.version = v
-        if v == 0:
+        if v == REVLOGV0:
             self.indexformat = indexformatv0
             shaoffset = v0shaoffset
         else:
@@ -369,7 +369,7 @@
                 # we've already got the entire data file read in, save it
                 # in the chunk data
                 self.chunkcache = (0, i)
-            if self.version != 0:
+            if self.version != REVLOGV0:
                 e = list(self.index[0])
                 type = self.ngtype(e[0])
                 e[0] = self.offset_type(0, type)
@@ -441,13 +441,13 @@
         if node == nullid: return (nullid, nullid)
         r = self.rev(node)
         d = self.index[r][-3:-1]
-        if self.version == 0:
+        if self.version == REVLOGV0:
             return d
         return [ self.node(x) for x in d ]
     def start(self, rev):
         if rev < 0:
             return -1
-        if self.version != 0:
+        if self.version != REVLOGV0:
             return self.ngoffset(self.index[rev][0])
         return self.index[rev][0]
 
@@ -456,7 +456,7 @@
     def size(self, rev):
         """return the length of the uncompressed text for a given revision"""
         l = -1
-        if self.version != 0:
+        if self.version != REVLOGV0:
             l = self.index[rev][2]
         if l >= 0:
             return l
@@ -911,7 +911,7 @@
         if t >= 0:
             offset = self.end(t)
 
-        if self.version == 0:
+        if self.version == REVLOGV0:
             e = (offset, l, base, link, p1, p2, node)
         else:
             e = (self.offset_type(offset, 0), l, len(text),
@@ -935,7 +935,7 @@
             f.seek(0, 2)
             transaction.add(self.indexfile, f.tell(), self.count() - 1)
 
-        if len(self.index) == 1 and self.version != 0:
+        if len(self.index) == 1 and self.version != REVLOGV0:
             l = struct.pack(versionformat, self.version)
             f.write(l)
             entry = entry[4:]
@@ -1135,7 +1135,7 @@
                     raise RevlogError(_("consistency error adding group"))
                 textlen = len(text)
             else:
-                if self.version == 0:
+                if self.version == REVLOGV0:
                     e = (end, len(cdelta), base, link, p1, p2, node)
                 else:
                     e = (self.offset_type(end, 0), len(cdelta), textlen, base,