Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 14637:5e9d691229d5
cmdutil: use ui descriptors in makefileobj
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 08 Jun 2011 14:54:52 +0300 |
parents | 217b7d83afc3 |
children | 1bdbca0b6604 |
comparison
equal
deleted
inserted
replaced
14636:b98063487a6f | 14637:5e9d691229d5 |
---|---|
158 seqno=None, revwidth=None, mode='wb', pathname=None): | 158 seqno=None, revwidth=None, mode='wb', pathname=None): |
159 | 159 |
160 writable = mode not in ('r', 'rb') | 160 writable = mode not in ('r', 'rb') |
161 | 161 |
162 if not pat or pat == '-': | 162 if not pat or pat == '-': |
163 fp = writable and sys.stdout or sys.stdin | 163 fp = writable and repo.ui.fout or repo.ui.fin |
164 return os.fdopen(os.dup(fp.fileno()), mode) | 164 return os.fdopen(os.dup(fp.fileno()), mode) |
165 if hasattr(pat, 'write') and writable: | 165 if hasattr(pat, 'write') and writable: |
166 return pat | 166 return pat |
167 if hasattr(pat, 'read') and 'r' in mode: | 167 if hasattr(pat, 'read') and 'r' in mode: |
168 return pat | 168 return pat |