diff tests/test-export.t @ 27416:9d04b4da6773

export: do not print '<fdopen>' as an output filename Because makefileobj() duplicates or wraps stdout, "fp != sys.stdout" didn't work correctly. Python doc states that special file objects are named in the form '<...>', and absolute filenames should never start with '<', we can ignore names start with '<'. We can't test fp.fileno() because fp may be a command-server channel. https://docs.python.org/2.7/library/stdtypes.html#file.name In the test output, "exporting patch:" line is printed after patch content. This is caused by fdopen() and will be fixed by the subsequent patch.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Dec 2015 19:47:46 +0900
parents e955549cd045
children 7e2495bf0ad8
line wrap: on
line diff
--- a/tests/test-export.t	Sun Dec 13 19:32:01 2015 +0900
+++ b/tests/test-export.t	Sun Dec 13 19:47:46 2015 +0900
@@ -137,6 +137,25 @@
    foo-9
   +foo-10
 
+No filename should be printed if stdout is specified explicitly:
+
+  $ hg export -v 1 -o -
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID d1c9656e973cfb5aebd5499bbd2cb350e3b12266
+  # Parent  871558de6af2e8c244222f8eea69b782c94ce3df
+  foo-1
+  
+  diff -r 871558de6af2 -r d1c9656e973c foo
+  --- a/foo	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,2 @@
+   foo-0
+  +foo-1
+  exporting patch:
+
 Checking if only alphanumeric characters are used in the file name (%m option):
 
   $ echo "line" >> foo