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.
--- 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)