Mercurial > public > mercurial-scm > hg
comparison hgext/fastannotate/protocol.py @ 41262:e40b7a504b1d
fastannotate: slice strings to get single character
Behaves identically on Python 3 and Python 2.
Differential Revision: https://phab.mercurial-scm.org/D5612
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 16 Jan 2019 11:55:49 -0500 |
parents | d8a7690ccc74 |
children | dfc73c803b77 |
comparison
equal
deleted
inserted
replaced
41261:1198c86beb73 | 41262:e40b7a504b1d |
---|---|
96 i = 0 | 96 i = 0 |
97 l = len(payload) - 1 | 97 l = len(payload) - 1 |
98 state = 0 # 0: vfspath, 1: size | 98 state = 0 # 0: vfspath, 1: size |
99 vfspath = size = '' | 99 vfspath = size = '' |
100 while i < l: | 100 while i < l: |
101 ch = payload[i] | 101 ch = payload[i:i + 1] |
102 if ch == '\0': | 102 if ch == '\0': |
103 if state == 1: | 103 if state == 1: |
104 result[vfspath] = buffer(payload, i + 1, int(size)) | 104 result[vfspath] = buffer(payload, i + 1, int(size)) |
105 i += int(size) | 105 i += int(size) |
106 state = 0 | 106 state = 0 |