Mercurial > hg
comparison tests/test-command-template.t @ 36504:b075f45456a5
py3: fix test-command-template.t to write files in binary mode
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 01 Mar 2018 08:55:39 -0500 |
parents | e8d37838f5df |
children | 106e93d16435 |
comparison
equal
deleted
inserted
replaced
36503:8b662717c53f | 36504:b075f45456a5 |
---|---|
2215 $ cd unstable-hash | 2215 $ cd unstable-hash |
2216 $ hg log --template '{date|age}\n' > /dev/null || exit 1 | 2216 $ hg log --template '{date|age}\n' > /dev/null || exit 1 |
2217 | 2217 |
2218 >>> from __future__ import absolute_import | 2218 >>> from __future__ import absolute_import |
2219 >>> import datetime | 2219 >>> import datetime |
2220 >>> fp = open('a', 'w') | 2220 >>> fp = open('a', 'wb') |
2221 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7) | 2221 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7) |
2222 >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day)) | 2222 >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) |
2223 >>> fp.close() | 2223 >>> fp.close() |
2224 $ hg add a | 2224 $ hg add a |
2225 $ hg commit -m future -d "`cat a`" | 2225 $ hg commit -m future -d "`cat a`" |
2226 | 2226 |
2227 $ hg log -l1 --template '{date|age}\n' | 2227 $ hg log -l1 --template '{date|age}\n' |
4571 Set up repository for non-ascii encoding tests: | 4571 Set up repository for non-ascii encoding tests: |
4572 | 4572 |
4573 $ hg init nonascii | 4573 $ hg init nonascii |
4574 $ cd nonascii | 4574 $ cd nonascii |
4575 $ $PYTHON <<EOF | 4575 $ $PYTHON <<EOF |
4576 > open('latin1', 'w').write('\xe9') | 4576 > open('latin1', 'wb').write(b'\xe9') |
4577 > open('utf-8', 'w').write('\xc3\xa9') | 4577 > open('utf-8', 'wb').write(b'\xc3\xa9') |
4578 > EOF | 4578 > EOF |
4579 $ HGENCODING=utf-8 hg branch -q `cat utf-8` | 4579 $ HGENCODING=utf-8 hg branch -q `cat utf-8` |
4580 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8 | 4580 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8 |
4581 | 4581 |
4582 json filter should try round-trip conversion to utf-8: | 4582 json filter should try round-trip conversion to utf-8: |