comparison mercurial/cmdutil.py @ 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 c84a07530040
children 9073a1e457c9
comparison
equal deleted inserted replaced
27415:f4ca33e33781 27416:9d04b4da6773
1054 fp = makefileobj(repo, template, node, desc=desc, total=total, 1054 fp = makefileobj(repo, template, node, desc=desc, total=total,
1055 seqno=seqno, revwidth=revwidth, mode='wb', 1055 seqno=seqno, revwidth=revwidth, mode='wb',
1056 modemap=filemode) 1056 modemap=filemode)
1057 if fp != template: 1057 if fp != template:
1058 shouldclose = True 1058 shouldclose = True
1059 if fp and fp != sys.stdout and util.safehasattr(fp, 'name'): 1059 if fp and not getattr(fp, 'name', '<unnamed>').startswith('<'):
1060 repo.ui.note("%s\n" % fp.name) 1060 repo.ui.note("%s\n" % fp.name)
1061 1061
1062 if not fp: 1062 if not fp:
1063 write = repo.ui.write 1063 write = repo.ui.write
1064 else: 1064 else: