Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 32582:7f4435078a8f
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 25 May 2017 21:43:09 +0900 |
parents | f4cd4c49e302 |
children | 7bfa1b199972 |
comparison
equal
deleted
inserted
replaced
32581:e9bf3e132ea9 | 32582:7f4435078a8f |
---|---|
2634 | 2634 |
2635 def cat(ui, repo, ctx, matcher, fntemplate, prefix, **opts): | 2635 def cat(ui, repo, ctx, matcher, fntemplate, prefix, **opts): |
2636 err = 1 | 2636 err = 1 |
2637 | 2637 |
2638 def write(path): | 2638 def write(path): |
2639 fp = makefileobj(repo, fntemplate, ctx.node(), | 2639 if fntemplate: |
2640 pathname=os.path.join(prefix, path)) | 2640 filename = makefilename(repo, fntemplate, ctx.node(), |
2641 pathname=os.path.join(prefix, path)) | |
2642 fp = open(filename, 'wb') | |
2643 else: | |
2644 fp = _unclosablefile(ui.fout) | |
2641 data = ctx[path].data() | 2645 data = ctx[path].data() |
2642 if opts.get('decode'): | 2646 if opts.get('decode'): |
2643 data = repo.wwritedata(path, data) | 2647 data = repo.wwritedata(path, data) |
2644 fp.write(data) | 2648 fp.write(data) |
2645 fp.close() | 2649 fp.close() |