Mercurial > hg
changeset 16375:d7d64b89a65c
revlog: allow retrieving contents by revision number
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 08 Apr 2012 12:38:02 -0500 |
parents | 29c2ff719715 |
children | d3908c911d5e |
files | mercurial/bundlerepo.py mercurial/revlog.py |
diffstat | 2 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py Sat Apr 07 15:43:18 2012 -0500 +++ b/mercurial/bundlerepo.py Sun Apr 08 12:38:02 2012 -0500 @@ -95,15 +95,21 @@ return mdiff.textdiff(self.revision(self.node(rev1)), self.revision(self.node(rev2))) - def revision(self, node): + def revision(self, nodeorrev): """return an uncompressed revision of a given""" + if isinstance(nodeorrev, int): + rev = nodeorrev + node = self.node(rev) + else: + node = nodeorrev + rev = self.rev(node) + if node == nullid: return "" text = None chain = [] iter_node = node - rev = self.rev(iter_node) # reconstruct the revision if it is from a changegroup while self.inbundle(rev): if self._cache and self._cache[0] == iter_node:
--- a/mercurial/revlog.py Sat Apr 07 15:43:18 2012 -0500 +++ b/mercurial/revlog.py Sun Apr 08 12:38:02 2012 -0500 @@ -858,8 +858,15 @@ return mdiff.textdiff(self.revision(self.node(rev1)), self.revision(self.node(rev2))) - def revision(self, node): - """return an uncompressed revision of a given node""" + def revision(self, nodeorrev): + """return an uncompressed revision of a given node or""" + if isinstance(nodeorrev, int): + rev = nodeorrev + node = self.node(rev) + else: + node = nodeorrev + rev = None + cachedrev = None if node == nullid: return "" @@ -870,7 +877,8 @@ # look up what we need to read text = None - rev = self.rev(node) + if rev is None: + rev = self.rev(node) # check rev flags if self.flags(rev) & ~REVIDX_KNOWN_FLAGS: