# HG changeset patch # User Yuya Nishihara # Date 1495716189 -32400 # Node ID 7f4435078a8f182b05b4f9450dd15255f2fdaa3f # Parent e9bf3e132ea9bda24e8073e9e26e3ee79f7f90f9 cat: stop using makefileobj() Prepares for porting to the formatter API. We won't be able to utilize the abstraction provided by makefilename() because formatter must be instantiated per file. diff -r e9bf3e132ea9 -r 7f4435078a8f mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat May 27 17:44:26 2017 +0900 +++ b/mercurial/cmdutil.py Thu May 25 21:43:09 2017 +0900 @@ -2636,8 +2636,12 @@ err = 1 def write(path): - fp = makefileobj(repo, fntemplate, ctx.node(), - pathname=os.path.join(prefix, path)) + if fntemplate: + filename = makefilename(repo, fntemplate, ctx.node(), + pathname=os.path.join(prefix, path)) + fp = open(filename, 'wb') + else: + fp = _unclosablefile(ui.fout) data = ctx[path].data() if opts.get('decode'): data = repo.wwritedata(path, data)