Mercurial > hg-stable
changeset 35525:a0fab647a8f1
revlog: don't use slicing to return parents
This is the only place we use a slice on index entries, which
are currently tuples. In preparation for moving away from tuples,
let's stop using slices so we don't have to implement that support
on the new type.
We also tweak the logic slightly so the exception only catches the
IndexError on the index lookup, not on the index entry lookup. The
old code should never have been buggy. But it was semantically wrong.
Differential Revision: https://phab.mercurial-scm.org/D1764
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 25 Dec 2017 16:31:14 -0700 |
parents | 711149d8e676 |
children | ab9d8d298510 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu Jan 04 16:29:03 2018 -0800 +++ b/mercurial/revlog.py Mon Dec 25 16:31:14 2017 -0700 @@ -622,12 +622,14 @@ def parentrevs(self, rev): try: - return self.index[rev][5:7] + entry = self.index[rev] except IndexError: if rev == wdirrev: raise error.WdirUnsupported raise + return entry[5], entry[6] + def node(self, rev): try: return self.index[rev][7]