diff -r d110167610db -r 7a9c905e51f9 mercurial/commands.py --- a/mercurial/commands.py Thu Apr 12 23:25:58 2018 +0900 +++ b/mercurial/commands.py Thu Apr 12 21:33:47 2018 +0900 @@ -1971,8 +1971,14 @@ ui.note(_('exporting patches:\n')) else: ui.note(_('exporting patch:\n')) - ui.pager('export') - cmdutil.export(repo, revs, fntemplate=opts.get('output'), + + fntemplate = opts.get('output') + if cmdutil.isstdiofilename(fntemplate): + fntemplate = '' + + if not fntemplate: + ui.pager('export') + cmdutil.export(repo, revs, fntemplate=fntemplate, switch_parent=opts.get('switch_parent'), opts=patch.diffallopts(ui, opts))