comparison mercurial/changelog.py @ 41574:b436059c1cca

py3: use pycompat.bytestr() on extra values because it can be int One such example is {'close': 1} which marks a branch as closed. This makes test-convert-mtn.t pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5864
author Pulkit Goyal <pulkit@yandex-team.ru>
date Tue, 05 Feb 2019 21:31:33 +0300
parents 1421d0487a61
children 6843379bf99e
comparison
equal deleted inserted replaced
41573:83d62df28ab6 41574:b436059c1cca
68 extra[k] = v 68 extra[k] = v
69 return extra 69 return extra
70 70
71 def encodeextra(d): 71 def encodeextra(d):
72 # keys must be sorted to produce a deterministic changelog entry 72 # keys must be sorted to produce a deterministic changelog entry
73 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)] 73 items = [
74 _string_escape('%s:%s' % (k, pycompat.bytestr(d[k])))
75 for k in sorted(d)
76 ]
74 return "\0".join(items) 77 return "\0".join(items)
75 78
76 def stripdesc(desc): 79 def stripdesc(desc):
77 """strip trailing whitespace and leading and trailing empty lines""" 80 """strip trailing whitespace and leading and trailing empty lines"""
78 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') 81 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n')