# HG changeset patch # User Augie Fackler # Date 1547657749 18000 # Node ID e40b7a504b1d20732af98f4c5123b80c4561ac25 # Parent 1198c86beb736ff47d03957a7713bdd631fa1df4 fastannotate: slice strings to get single character Behaves identically on Python 3 and Python 2. Differential Revision: https://phab.mercurial-scm.org/D5612 diff -r 1198c86beb73 -r e40b7a504b1d hgext/fastannotate/formatter.py --- a/hgext/fastannotate/formatter.py Wed Jan 16 11:55:01 2019 -0500 +++ b/hgext/fastannotate/formatter.py Wed Jan 16 11:55:49 2019 -0500 @@ -103,7 +103,7 @@ result += ': ' + self.ui.label('-' + lines[i], 'diff.deleted') - if result[-1] != '\n': + if result[-1:] != '\n': result += '\n' self.ui.write(result) diff -r 1198c86beb73 -r e40b7a504b1d hgext/fastannotate/protocol.py --- a/hgext/fastannotate/protocol.py Wed Jan 16 11:55:01 2019 -0500 +++ b/hgext/fastannotate/protocol.py Wed Jan 16 11:55:49 2019 -0500 @@ -98,7 +98,7 @@ state = 0 # 0: vfspath, 1: size vfspath = size = '' while i < l: - ch = payload[i] + ch = payload[i:i + 1] if ch == '\0': if state == 1: result[vfspath] = buffer(payload, i + 1, int(size))