diff -r 447bbd970047 -r f4cd4c49e302 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Thu May 25 21:28:08 2017 +0900 +++ b/mercurial/cmdutil.py Sat May 27 18:50:05 2017 +0900 @@ -2632,11 +2632,11 @@ return ret -def cat(ui, repo, ctx, matcher, prefix, **opts): +def cat(ui, repo, ctx, matcher, fntemplate, prefix, **opts): err = 1 def write(path): - fp = makefileobj(repo, opts.get('output'), ctx.node(), + fp = makefileobj(repo, fntemplate, ctx.node(), pathname=os.path.join(prefix, path)) data = ctx[path].data() if opts.get('decode'): @@ -2666,8 +2666,8 @@ try: submatch = matchmod.subdirmatcher(subpath, matcher) - if not sub.cat(submatch, os.path.join(prefix, sub._path), - **opts): + if not sub.cat(submatch, fntemplate, + os.path.join(prefix, sub._path), **opts): err = 0 except error.RepoLookupError: ui.status(_("skipping missing subrepository: %s\n")