changeset 27419:7e2495bf0ad8

cmdutil: do not duplicate stdout by makefileobj() It made output order unpredictable because two separate buffers are flushed individually. Let's use a thin wrapper that just sends close() to black hole.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Dec 2015 20:07:19 +0900
parents 2ce4661ac226
children 3da583097fca
files mercurial/cmdutil.py tests/test-export.t
diffstat 2 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Dec 13 20:01:11 2015 +0900
+++ b/mercurial/cmdutil.py	Sun Dec 13 20:07:19 2015 +0900
@@ -462,12 +462,7 @@
             fp = repo.ui.fout
         else:
             fp = repo.ui.fin
-        if util.safehasattr(fp, 'fileno'):
-            return os.fdopen(os.dup(fp.fileno()), mode)
-        else:
-            # if this fp can't be duped properly, return
-            # a dummy object that can be closed
-            return _unclosablefile(fp)
+        return _unclosablefile(fp)
     if util.safehasattr(pat, 'write') and writable:
         return pat
     if util.safehasattr(pat, 'read') and 'r' in mode:
--- a/tests/test-export.t	Sun Dec 13 20:01:11 2015 +0900
+++ b/tests/test-export.t	Sun Dec 13 20:07:19 2015 +0900
@@ -140,6 +140,7 @@
 No filename should be printed if stdout is specified explicitly:
 
   $ hg export -v 1 -o -
+  exporting patch:
   # HG changeset patch
   # User test
   # Date 0 0
@@ -154,7 +155,6 @@
   @@ -1,1 +1,2 @@
    foo-0
   +foo-1
-  exporting patch:
 
 Checking if only alphanumeric characters are used in the file name (%m option):