mercurial/cmdutil.py
changeset 13121 bf763946f8b0
parent 13081 79184986658c
child 13386 f78bc5ddbe4f
equal deleted inserted replaced
13120:8568bbdfbafe 13121:bf763946f8b0
   231               total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
   231               total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
   232 
   232 
   233     writable = 'w' in mode or 'a' in mode
   233     writable = 'w' in mode or 'a' in mode
   234 
   234 
   235     if not pat or pat == '-':
   235     if not pat or pat == '-':
   236         return writable and sys.stdout or sys.stdin
   236         fp = writable and sys.stdout or sys.stdin
       
   237         return os.fdopen(os.dup(fp.fileno()), mode)
   237     if hasattr(pat, 'write') and writable:
   238     if hasattr(pat, 'write') and writable:
   238         return pat
   239         return pat
   239     if hasattr(pat, 'read') and 'r' in mode:
   240     if hasattr(pat, 'read') and 'r' in mode:
   240         return pat
   241         return pat
   241     return open(make_filename(repo, pat, node, total, seqno, revwidth,
   242     return open(make_filename(repo, pat, node, total, seqno, revwidth,