Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 36566:1d99260c3a81
py3: slice over bytes to prevent getting ascii values
This fixed reading of mergestate files and fixes 14 tests on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2522
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 02 Mar 2018 02:44:49 +0530 |
parents | 035b77bf01d2 |
children | 658b1d28813c |
comparison
equal
deleted
inserted
replaced
36565:3cd245945ef3 | 36566:1d99260c3a81 |
---|---|
285 f = self._repo.vfs(self.statepathv2) | 285 f = self._repo.vfs(self.statepathv2) |
286 data = f.read() | 286 data = f.read() |
287 off = 0 | 287 off = 0 |
288 end = len(data) | 288 end = len(data) |
289 while off < end: | 289 while off < end: |
290 rtype = data[off] | 290 rtype = data[off:off + 1] |
291 off += 1 | 291 off += 1 |
292 length = _unpack('>I', data[off:(off + 4)])[0] | 292 length = _unpack('>I', data[off:(off + 4)])[0] |
293 off += 4 | 293 off += 4 |
294 record = data[off:(off + length)] | 294 record = data[off:(off + length)] |
295 off += length | 295 off += length |
296 if rtype == 't': | 296 if rtype == 't': |
297 rtype, record = record[0], record[1:] | 297 rtype, record = record[0:1], record[1:] |
298 records.append((rtype, record)) | 298 records.append((rtype, record)) |
299 f.close() | 299 f.close() |
300 except IOError as err: | 300 except IOError as err: |
301 if err.errno != errno.ENOENT: | 301 if err.errno != errno.ENOENT: |
302 raise | 302 raise |