##// END OF EJS Templates
revlog: move stat inside lazyparser
Matt Mackall -
r8641:33686ef2 default
parent child Browse files
Show More
@@ -119,7 +119,11 b' class lazyparser(object):'
119 # available. it keeps file handle open, which make it not possible
119 # available. it keeps file handle open, which make it not possible
120 # to break hardlinks on local cloned repos.
120 # to break hardlinks on local cloned repos.
121
121
122 def __init__(self, dataf, size):
122 def __init__(self, dataf):
123 try:
124 size = util.fstat(dataf).st_size
125 except AttributeError:
126 size = 0
123 self.dataf = dataf
127 self.dataf = dataf
124 self.s = struct.calcsize(indexformatng)
128 self.s = struct.calcsize(indexformatng)
125 self.datasize = size
129 self.datasize = size
@@ -362,15 +366,10 b' class revlogio(object):'
362 self.size = struct.calcsize(indexformatng)
366 self.size = struct.calcsize(indexformatng)
363
367
364 def parseindex(self, fp, data, inline):
368 def parseindex(self, fp, data, inline):
365 size = len(data)
369 if len(data) == _prereadsize:
366 if size == _prereadsize:
367 if util.openhardlinks() and not inline:
370 if util.openhardlinks() and not inline:
368 try:
369 size = util.fstat(fp).st_size
370 except AttributeError:
371 size = 0
372 # big index, let's parse it on demand
371 # big index, let's parse it on demand
373 parser = lazyparser(fp, size)
372 parser = lazyparser(fp)
374 index = lazyindex(parser)
373 index = lazyindex(parser)
375 nodemap = lazymap(parser)
374 nodemap = lazymap(parser)
376 e = list(index[0])
375 e = list(index[0])
General Comments 0
You need to be logged in to leave comments. Login now