If the argument to make_file can act like a file, return it.
This is useful for code that calls command functions, but doesn't
want to send I/O through the filesystem.
--- a/mercurial/commands.py Wed Jul 20 03:52:06 2005 -0800
+++ b/mercurial/commands.py Wed Jul 20 03:55:16 2005 -0800
@@ -121,6 +121,10 @@
if not pat or pat == '-':
if 'w' in mode: return sys.stdout
else: return sys.stdin
+ if hasattr(pat, 'write') and 'w' in mode:
+ return pat
+ if hasattr(pat, 'read') and 'r' in mode:
+ return pat
node_expander = {
'H': lambda: hg.hex(node),
'R': lambda: str(r.rev(node)),