##// END OF EJS Templates
revlog: add some documentation to `_revisiondata` code
marmoute -
r43058:616aa62e default
parent child Browse files
Show More
@@ -1611,6 +1611,7 b' class revlog(object):'
1611 return self._revisiondata(nodeorrev, _df, raw=raw)
1611 return self._revisiondata(nodeorrev, _df, raw=raw)
1612
1612
1613 def _revisiondata(self, nodeorrev, _df=None, raw=False):
1613 def _revisiondata(self, nodeorrev, _df=None, raw=False):
1614 # deal with <nodeorrev> argument type
1614 if isinstance(nodeorrev, int):
1615 if isinstance(nodeorrev, int):
1615 rev = nodeorrev
1616 rev = nodeorrev
1616 node = self.node(rev)
1617 node = self.node(rev)
@@ -1618,19 +1619,31 b' class revlog(object):'
1618 node = nodeorrev
1619 node = nodeorrev
1619 rev = None
1620 rev = None
1620
1621
1622 # fast path the special `nullid` rev
1621 if node == nullid:
1623 if node == nullid:
1622 return ""
1624 return ""
1623
1625
1626 # revision in the cache (could be useful to apply delta)
1624 cachedrev = None
1627 cachedrev = None
1628 # the revlog's flag for this revision
1629 # (usually alter its state or content)
1625 flags = None
1630 flags = None
1631 # The text as stored inside the revlog. Might be the revision or might
1632 # need to be processed to retrieve the revision.
1626 rawtext = None
1633 rawtext = None
1634 # An intermediate text to apply deltas to
1627 basetext = None
1635 basetext = None
1636
1637 # Check if we have the entry in cache
1638 # The cache entry looks like (node, rev, rawtext)
1628 if self._revisioncache:
1639 if self._revisioncache:
1629 if self._revisioncache[0] == node:
1640 if self._revisioncache[0] == node:
1630 # _cache only stores rawtext
1641 # _cache only stores rawtext
1631 # rawtext is reusable. but we might need to run flag processors
1642 # rawtext is reusable. but we might need to run flag processors
1632 rawtext = self._revisioncache[2]
1643 rawtext = self._revisioncache[2]
1633 if raw:
1644 if raw:
1645 # if we don't want to process the raw text and that raw
1646 # text is cached, we can exit early.
1634 return rawtext
1647 return rawtext
1635 # duplicated, but good for perf
1648 # duplicated, but good for perf
1636 if rev is None:
1649 if rev is None:
General Comments 0
You need to be logged in to leave comments. Login now