comparison mercurial/cmdutil.py @ 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 a801d331a022
comparison
equal deleted inserted replaced
27418:2ce4661ac226 27419:7e2495bf0ad8
460 if not pat or pat == '-': 460 if not pat or pat == '-':
461 if writable: 461 if writable:
462 fp = repo.ui.fout 462 fp = repo.ui.fout
463 else: 463 else:
464 fp = repo.ui.fin 464 fp = repo.ui.fin
465 if util.safehasattr(fp, 'fileno'): 465 return _unclosablefile(fp)
466 return os.fdopen(os.dup(fp.fileno()), mode)
467 else:
468 # if this fp can't be duped properly, return
469 # a dummy object that can be closed
470 return _unclosablefile(fp)
471 if util.safehasattr(pat, 'write') and writable: 466 if util.safehasattr(pat, 'write') and writable:
472 return pat 467 return pat
473 if util.safehasattr(pat, 'read') and 'r' in mode: 468 if util.safehasattr(pat, 'read') and 'r' in mode:
474 return pat 469 return pat
475 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) 470 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)