Mercurial > hg
comparison mercurial/formatter.py @ 32829:8016fe56a29e
formatter: open raw template file in binary mode (BC)
I believe it was a mistake to open file in text mode. Now '\r' is preserved
on Windows, but it should be okay to print '\r\n' as long as users live in
such platform.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 06 May 2017 14:47:31 +0900 |
parents | 526f9f12f707 |
children | 470820c2418d |
comparison
equal
deleted
inserted
replaced
32828:526f9f12f707 | 32829:8016fe56a29e |
---|---|
397 # perhaps it's a path to a map or a template | 397 # perhaps it's a path to a map or a template |
398 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl): | 398 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl): |
399 # is it a mapfile for a style? | 399 # is it a mapfile for a style? |
400 if os.path.basename(tmpl).startswith("map-"): | 400 if os.path.basename(tmpl).startswith("map-"): |
401 return None, os.path.realpath(tmpl) | 401 return None, os.path.realpath(tmpl) |
402 with open(tmpl) as f: | 402 with open(tmpl, 'rb') as f: |
403 tmpl = f.read() | 403 tmpl = f.read() |
404 return tmpl, None | 404 return tmpl, None |
405 | 405 |
406 # constant string? | 406 # constant string? |
407 return tmpl, None | 407 return tmpl, None |