mercurial/cmdutil.py
changeset 7319 eae1767cc6a8
parent 7308 b6f5490effbf
child 7361 9fe97eea5510
--- a/mercurial/cmdutil.py	Thu Nov 06 10:39:52 2008 +0100
+++ b/mercurial/cmdutil.py	Thu Nov 06 11:17:38 2008 +0100
@@ -214,9 +214,12 @@
 
 def make_file(repo, pat, node=None,
               total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
+
+    writable = 'w' in mode or 'a' in mode
+
     if not pat or pat == '-':
-        return 'w' in mode and sys.stdout or sys.stdin
-    if hasattr(pat, 'write') and 'w' in mode:
+        return writable and sys.stdout or sys.stdin
+    if hasattr(pat, 'write') and writable:
         return pat
     if hasattr(pat, 'read') and 'r' in mode:
         return pat