diff -r 2dd8d4108249 -r 447bbd970047 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Thu May 25 21:25:49 2017 +0900 +++ b/mercurial/cmdutil.py Thu May 25 21:28:08 2017 +0900 @@ -610,6 +610,10 @@ raise error.Abort(_("invalid format spec '%%%s' in output filename") % inst.args[0]) +def isstdiofilename(pat): + """True if the given pat looks like a filename denoting stdin/stdout""" + return not pat or pat == '-' + class _unclosablefile(object): def __init__(self, fp): self._fp = fp @@ -635,7 +639,7 @@ writable = mode not in ('r', 'rb') - if not pat or pat == '-': + if isstdiofilename(pat): if writable: fp = repo.ui.fout else: