##// END OF EJS Templates
revlog: reorder index accessors to match data structure order...
Gregory Szorc -
r30287:0986f225 default
parent child Browse files
Show More
@@ -380,22 +380,29 b' class revlog(object):'
380 return r
380 return r
381 raise LookupError(node, self.indexfile, _('no node'))
381 raise LookupError(node, self.indexfile, _('no node'))
382
382
383 def node(self, rev):
383 # Accessors for index entries.
384 return self.index[rev][7]
384
385 def linkrev(self, rev):
385 # First tuple entry is 8 bytes. First 6 bytes are offset. Last 2 bytes
386 return self.index[rev][4]
386 # are flags.
387 def parents(self, node):
388 i = self.index
389 d = i[self.rev(node)]
390 return i[d[5]][7], i[d[6]][7] # map revisions to nodes inline
391 def parentrevs(self, rev):
392 return self.index[rev][5:7]
393 def start(self, rev):
387 def start(self, rev):
394 return int(self.index[rev][0] >> 16)
388 return int(self.index[rev][0] >> 16)
395 def end(self, rev):
389
396 return self.start(rev) + self.length(rev)
390 def flags(self, rev):
391 return self.index[rev][0] & 0xFFFF
392
397 def length(self, rev):
393 def length(self, rev):
398 return self.index[rev][1]
394 return self.index[rev][1]
395
396 def rawsize(self, rev):
397 """return the length of the uncompressed text for a given revision"""
398 l = self.index[rev][2]
399 if l >= 0:
400 return l
401
402 t = self.revision(self.node(rev))
403 return len(t)
404 size = rawsize
405
399 def chainbase(self, rev):
406 def chainbase(self, rev):
400 base = self._chainbasecache.get(rev)
407 base = self._chainbasecache.get(rev)
401 if base is not None:
408 if base is not None:
@@ -409,6 +416,26 b' class revlog(object):'
409
416
410 self._chainbasecache[rev] = base
417 self._chainbasecache[rev] = base
411 return base
418 return base
419
420 def linkrev(self, rev):
421 return self.index[rev][4]
422
423 def parentrevs(self, rev):
424 return self.index[rev][5:7]
425
426 def node(self, rev):
427 return self.index[rev][7]
428
429 # Derived from index values.
430
431 def end(self, rev):
432 return self.start(rev) + self.length(rev)
433
434 def parents(self, node):
435 i = self.index
436 d = i[self.rev(node)]
437 return i[d[5]][7], i[d[6]][7] # map revisions to nodes inline
438
412 def chainlen(self, rev):
439 def chainlen(self, rev):
413 return self._chaininfo(rev)[0]
440 return self._chaininfo(rev)[0]
414
441
@@ -478,18 +505,6 b' class revlog(object):'
478 chain.reverse()
505 chain.reverse()
479 return chain, stopped
506 return chain, stopped
480
507
481 def flags(self, rev):
482 return self.index[rev][0] & 0xFFFF
483 def rawsize(self, rev):
484 """return the length of the uncompressed text for a given revision"""
485 l = self.index[rev][2]
486 if l >= 0:
487 return l
488
489 t = self.revision(self.node(rev))
490 return len(t)
491 size = rawsize
492
493 def ancestors(self, revs, stoprev=0, inclusive=False):
508 def ancestors(self, revs, stoprev=0, inclusive=False):
494 """Generate the ancestors of 'revs' in reverse topological order.
509 """Generate the ancestors of 'revs' in reverse topological order.
495 Does not generate revs lower than stoprev.
510 Does not generate revs lower than stoprev.
General Comments 0
You need to be logged in to leave comments. Login now