Patchwork [3,of,8] formatter: open raw template file in posix semantics

login
register
mail settings
Submitter Yuya Nishihara
Date June 14, 2017, 1:40 p.m.
Message ID <b1c1aab629501208e0b8.1497447634@mimosa>
Download mbox | patch
Permalink /patch/21373/
State Accepted
Headers show

Comments

Yuya Nishihara - June 14, 2017, 1:40 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1494049727 -32400
#      Sat May 06 14:48:47 2017 +0900
# Node ID b1c1aab629501208e0b84b2c604328eea4311d4c
# Parent  4642ef5a653b3daa3db1121e8bdd1351b98b28fc
formatter: open raw template file in posix semantics

This should have no effect, but seems good for code consistency.

Patch

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, 'rb') as f:
+        with util.posixfile(tmpl, 'rb') as f:
             tmpl = f.read()
         return tmpl, None