commands: use ui descriptors when reading/writing from stdin/out
authorIdan Kamara <idankk86@gmail.com>
Wed, 08 Jun 2011 14:54:52 +0300
changeset 14639 e59a7b8f521a
parent 14638 1bdbca0b6604
child 14640 406b6d7bdcb9
commands: use ui descriptors when reading/writing from stdin/out
mercurial/commands.py
--- 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)