##// END OF EJS Templates
Replaced 0 with REVLOGV0 where this meaning is used.
Thomas Arendsen Hein -
r2142:8a1e2a9c default
parent child Browse files
Show More
@@ -11,7 +11,7 b' from demandload import demandload'
11 demandload(globals(), "os time util")
11 demandload(globals(), "os time util")
12
12
13 class changelog(revlog):
13 class changelog(revlog):
14 def __init__(self, opener, defversion=0):
14 def __init__(self, opener, defversion=REVLOGV0):
15 revlog.__init__(self, opener, "00changelog.i", "00changelog.d",
15 revlog.__init__(self, opener, "00changelog.i", "00changelog.d",
16 defversion)
16 defversion)
17
17
@@ -42,7 +42,7 b' class localrepository(object):'
42 pass
42 pass
43
43
44 v = self.ui.revlogopts
44 v = self.ui.revlogopts
45 self.revlogversion = int(v.get('format', 0))
45 self.revlogversion = int(v.get('format', revlog.REVLOGV0))
46 flags = 0
46 flags = 0
47 for x in v.get('flags', "").split():
47 for x in v.get('flags', "").split():
48 flags |= revlog.flagstr(x)
48 flags |= revlog.flagstr(x)
@@ -12,7 +12,7 b' from demandload import *'
12 demandload(globals(), "bisect array")
12 demandload(globals(), "bisect array")
13
13
14 class manifest(revlog):
14 class manifest(revlog):
15 def __init__(self, opener, defversion=0):
15 def __init__(self, opener, defversion=REVLOGV0):
16 self.mapcache = None
16 self.mapcache = None
17 self.listcache = None
17 self.listcache = None
18 revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
18 revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
@@ -293,7 +293,7 b' class revlog(object):'
293 remove data, and can use some simple techniques to avoid the need
293 remove data, and can use some simple techniques to avoid the need
294 for locking while reading.
294 for locking while reading.
295 """
295 """
296 def __init__(self, opener, indexfile, datafile, defversion=0):
296 def __init__(self, opener, indexfile, datafile, defversion=REVLOGV0):
297 """
297 """
298 create a revlog object
298 create a revlog object
299
299
@@ -337,7 +337,7 b' class revlog(object):'
337 v = struct.unpack(versionformat, i)[0]
337 v = struct.unpack(versionformat, i)[0]
338 flags = v & ~0xFFFF
338 flags = v & ~0xFFFF
339 fmt = v & 0xFFFF
339 fmt = v & 0xFFFF
340 if fmt == 0:
340 if fmt == REVLOGV0:
341 if flags:
341 if flags:
342 raise RevlogError(_("index %s invalid flags %x for format v0" %
342 raise RevlogError(_("index %s invalid flags %x for format v0" %
343 (self.indexfile, flags)))
343 (self.indexfile, flags)))
@@ -349,7 +349,7 b' class revlog(object):'
349 raise RevlogError(_("index %s invalid format %d" %
349 raise RevlogError(_("index %s invalid format %d" %
350 (self.indexfile, fmt)))
350 (self.indexfile, fmt)))
351 self.version = v
351 self.version = v
352 if v == 0:
352 if v == REVLOGV0:
353 self.indexformat = indexformatv0
353 self.indexformat = indexformatv0
354 shaoffset = v0shaoffset
354 shaoffset = v0shaoffset
355 else:
355 else:
@@ -369,7 +369,7 b' class revlog(object):'
369 # we've already got the entire data file read in, save it
369 # we've already got the entire data file read in, save it
370 # in the chunk data
370 # in the chunk data
371 self.chunkcache = (0, i)
371 self.chunkcache = (0, i)
372 if self.version != 0:
372 if self.version != REVLOGV0:
373 e = list(self.index[0])
373 e = list(self.index[0])
374 type = self.ngtype(e[0])
374 type = self.ngtype(e[0])
375 e[0] = self.offset_type(0, type)
375 e[0] = self.offset_type(0, type)
@@ -441,13 +441,13 b' class revlog(object):'
441 if node == nullid: return (nullid, nullid)
441 if node == nullid: return (nullid, nullid)
442 r = self.rev(node)
442 r = self.rev(node)
443 d = self.index[r][-3:-1]
443 d = self.index[r][-3:-1]
444 if self.version == 0:
444 if self.version == REVLOGV0:
445 return d
445 return d
446 return [ self.node(x) for x in d ]
446 return [ self.node(x) for x in d ]
447 def start(self, rev):
447 def start(self, rev):
448 if rev < 0:
448 if rev < 0:
449 return -1
449 return -1
450 if self.version != 0:
450 if self.version != REVLOGV0:
451 return self.ngoffset(self.index[rev][0])
451 return self.ngoffset(self.index[rev][0])
452 return self.index[rev][0]
452 return self.index[rev][0]
453
453
@@ -456,7 +456,7 b' class revlog(object):'
456 def size(self, rev):
456 def size(self, rev):
457 """return the length of the uncompressed text for a given revision"""
457 """return the length of the uncompressed text for a given revision"""
458 l = -1
458 l = -1
459 if self.version != 0:
459 if self.version != REVLOGV0:
460 l = self.index[rev][2]
460 l = self.index[rev][2]
461 if l >= 0:
461 if l >= 0:
462 return l
462 return l
@@ -911,7 +911,7 b' class revlog(object):'
911 if t >= 0:
911 if t >= 0:
912 offset = self.end(t)
912 offset = self.end(t)
913
913
914 if self.version == 0:
914 if self.version == REVLOGV0:
915 e = (offset, l, base, link, p1, p2, node)
915 e = (offset, l, base, link, p1, p2, node)
916 else:
916 else:
917 e = (self.offset_type(offset, 0), l, len(text),
917 e = (self.offset_type(offset, 0), l, len(text),
@@ -935,7 +935,7 b' class revlog(object):'
935 f.seek(0, 2)
935 f.seek(0, 2)
936 transaction.add(self.indexfile, f.tell(), self.count() - 1)
936 transaction.add(self.indexfile, f.tell(), self.count() - 1)
937
937
938 if len(self.index) == 1 and self.version != 0:
938 if len(self.index) == 1 and self.version != REVLOGV0:
939 l = struct.pack(versionformat, self.version)
939 l = struct.pack(versionformat, self.version)
940 f.write(l)
940 f.write(l)
941 entry = entry[4:]
941 entry = entry[4:]
@@ -1135,7 +1135,7 b' class revlog(object):'
1135 raise RevlogError(_("consistency error adding group"))
1135 raise RevlogError(_("consistency error adding group"))
1136 textlen = len(text)
1136 textlen = len(text)
1137 else:
1137 else:
1138 if self.version == 0:
1138 if self.version == REVLOGV0:
1139 e = (end, len(cdelta), base, link, p1, p2, node)
1139 e = (end, len(cdelta), base, link, p1, p2, node)
1140 else:
1140 else:
1141 e = (self.offset_type(end, 0), len(cdelta), textlen, base,
1141 e = (self.offset_type(end, 0), len(cdelta), textlen, base,
General Comments 0
You need to be logged in to leave comments. Login now