mercurial/commands.py
changeset 738 32a97c9d8e98
parent 737 8db4d406b3d3
child 739 36edb39e8e8c
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -121,6 +121,10 @@ def make_file(repo, r, pat, node=None,
     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)),