Patchwork cmdutil: use isstdiofilename() where appropriate

login
register
mail settings
Submitter Yuya Nishihara
Date June 1, 2017, 2:37 p.m.
Message ID <fbc9705beb0eb803e6ef.1496327854@mimosa>
Download mbox | patch
Permalink /patch/21128/
State Accepted
Headers show

Comments

Yuya Nishihara - June 1, 2017, 2:37 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1496326103 -32400
#      Thu Jun 01 23:08:23 2017 +0900
# Node ID fbc9705beb0eb803e6efd2234fcb1de6ffb358de
# Parent  ee0119499321b4b1df8e04694d82f6ca425e60df
cmdutil: use isstdiofilename() where appropriate
Augie Fackler - June 1, 2017, 2:55 p.m.
On Thu, Jun 01, 2017 at 11:37:34PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1496326103 -32400
> #      Thu Jun 01 23:08:23 2017 +0900
> # Node ID fbc9705beb0eb803e6efd2234fcb1de6ffb358de
> # Parent  ee0119499321b4b1df8e04694d82f6ca425e60df
> cmdutil: use isstdiofilename() where appropriate

Queued, thanks.

>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -493,7 +493,7 @@ def logmessage(ui, opts):
>                             'exclusive'))
>      if not message and logfile:
>          try:
> -            if logfile == '-':
> +            if isstdiofilename(logfile):
>                  message = ui.fin.read()
>              else:
>                  message = '\n'.join(util.readfile(logfile).splitlines())
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -493,7 +493,7 @@  def logmessage(ui, opts):
                            'exclusive'))
     if not message and logfile:
         try:
-            if logfile == '-':
+            if isstdiofilename(logfile):
                 message = ui.fin.read()
             else:
                 message = '\n'.join(util.readfile(logfile).splitlines())