equal
deleted
inserted
replaced
85 |
85 |
86 class lazyparser(object): |
86 class lazyparser(object): |
87 """ |
87 """ |
88 this class avoids the need to parse the entirety of large indices |
88 this class avoids the need to parse the entirety of large indices |
89 """ |
89 """ |
|
90 |
|
91 # lazyparser is not safe to use on windows if win32 extensions not |
|
92 # available. it keeps file handle open, which make it not possible |
|
93 # to break hardlinks on local cloned repos. |
|
94 safe_to_use = os.name != 'nt' or (not util.is_win_9x() and |
|
95 hasattr(util, 'win32api')) |
|
96 |
90 def __init__(self, dataf, size, indexformat, shaoffset): |
97 def __init__(self, dataf, size, indexformat, shaoffset): |
91 self.dataf = dataf |
98 self.dataf = dataf |
92 self.format = indexformat |
99 self.format = indexformat |
93 self.s = struct.calcsize(indexformat) |
100 self.s = struct.calcsize(indexformat) |
94 self.indexformat = indexformat |
101 self.indexformat = indexformat |
360 else: |
367 else: |
361 self.indexformat = indexformatng |
368 self.indexformat = indexformatng |
362 shaoffset = ngshaoffset |
369 shaoffset = ngshaoffset |
363 |
370 |
364 if i: |
371 if i: |
365 if not self.inlinedata() and st and st.st_size > 10000: |
372 if (lazyparser.safe_to_use and not self.inlinedata() and |
|
373 st and st.st_size > 10000): |
366 # big index, let's parse it on demand |
374 # big index, let's parse it on demand |
367 parser = lazyparser(f, st.st_size, self.indexformat, shaoffset) |
375 parser = lazyparser(f, st.st_size, self.indexformat, shaoffset) |
368 self.index = lazyindex(parser) |
376 self.index = lazyindex(parser) |
369 self.nodemap = lazymap(parser) |
377 self.nodemap = lazymap(parser) |
370 else: |
378 else: |