comparison tests/svnxml.py @ 40216:c17d73bf6a4d

py3: use sys.stdout.buffer for binary output in tests/svnxml.py Just following 6c0b1d964537ab62d76c208f5f04ab414814c94e here. Differential Revision: https://phab.mercurial-scm.org/D5027
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sat, 13 Oct 2018 03:59:15 +0300
parents 812eb3b7dc43
children 7c54357be2ae
comparison
equal deleted inserted replaced
40215:4d6019c0e0ef 40216:c17d73bf6a4d
33 for e in doc.getElementsByTagName('logentry'): 33 for e in doc.getElementsByTagName('logentry'):
34 entries.append(parseentry(e)) 34 entries.append(parseentry(e))
35 return entries 35 return entries
36 36
37 def printentries(entries): 37 def printentries(entries):
38 fp = sys.stdout 38 try:
39 fp = sys.stdout.buffer
40 except AttributeError:
41 fp = sys.stdout
39 for e in entries: 42 for e in entries:
40 for k in ('revision', 'author', 'msg'): 43 for k in ('revision', 'author', 'msg'):
41 fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8')) 44 fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))
42 for path, action, fpath, frev in sorted(e['paths']): 45 for path, action, fpath, frev in sorted(e['paths']):
43 frominfo = '' 46 frominfo = ''