diff mercurial/commands.py @ 14639:e59a7b8f521a

commands: use ui descriptors when reading/writing from stdin/out
author Idan Kamara <idankk86@gmail.com>
date Wed, 08 Jun 2011 14:54:52 +0300
parents 217b7d83afc3
children e4cfdff6d3f4
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jun 15 23:50:33 2011 +0300
+++ b/mercurial/commands.py	Wed Jun 08 14:54:52 2011 +0300
@@ -8,7 +8,7 @@
 from node import hex, bin, nullid, nullrev, short
 from lock import release
 from i18n import _, gettext
-import os, re, sys, difflib, time, tempfile, errno
+import os, re, difflib, time, tempfile, errno
 import hg, scmutil, util, revlog, extensions, copies, error, bookmarks
 import patch, help, url, encoding, templatekw, discovery
 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
@@ -336,7 +336,7 @@
     if dest == '-':
         if kind == 'files':
             raise util.Abort(_('cannot archive plain files to stdout'))
-        dest = sys.stdout
+        dest = ui.fout
         if not prefix:
             prefix = os.path.basename(repo.root) + '-%h'
 
@@ -1232,7 +1232,7 @@
 
     if text is None:
         ui.status(_("reading DAG from stdin\n"))
-        text = sys.stdin.read()
+        text = ui.fin.read()
 
     cl = repo.changelog
     if len(cl) > 0:
@@ -3194,7 +3194,7 @@
 
             if pf == '-':
                 ui.status(_("applying patch from stdin\n"))
-                pf = sys.stdin
+                pf = ui.fin
             else:
                 ui.status(_("applying %s\n") % p)
                 pf = url.open(ui, pf)