comparison mercurial/formatter.py @ 32828:526f9f12f707

formatter: close raw template file explicitly
author Yuya Nishihara <yuya@tcha.org>
date Sat, 06 May 2017 14:40:22 +0900
parents e9bf3e132ea9
children 8016fe56a29e
comparison
equal deleted inserted replaced
32826:3abba5bc3454 32828:526f9f12f707
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 tmpl = open(tmpl).read() 402 with open(tmpl) as f:
403 tmpl = f.read()
403 return tmpl, None 404 return tmpl, None
404 405
405 # constant string? 406 # constant string?
406 return tmpl, None 407 return tmpl, None
407 408