# HG changeset patch # User Yuya Nishihara # Date 2017-05-06 05:47:31 # Node ID 8016fe56a29e2f7ec49523694683998b8fd3149e # Parent 526f9f12f707d38889817f9ebc6f42f35e1e62ff 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. diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -399,7 +399,7 @@ def lookuptemplate(ui, topic, tmpl): # is it a mapfile for a style? if os.path.basename(tmpl).startswith("map-"): return None, os.path.realpath(tmpl) - with open(tmpl) as f: + with open(tmpl, 'rb') as f: tmpl = f.read() return tmpl, None