Patchwork [2,of,5] convert: have debugsvnlog obtain standard streams from ui

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 2, 2016, 12:02 p.m.
Message ID <ed456439699b5af90a3a.1478088134@mimosa>
Download mbox | patch
Permalink /patch/17273/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 2, 2016, 12:02 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1443850496 -32400
#      Sat Oct 03 14:34:56 2015 +0900
# Node ID ed456439699b5af90a3a5ae36a8ac82431448c68
# Parent  5a7ca4f3983a0cd1573c3da450516b6c6a6277e0
# EXP-Topic stdio
convert: have debugsvnlog obtain standard streams from ui

This will help porting to Python 3, where sys.stdin/out/err are unfortunately
unicode streams so we can't use them directly.

Patch

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -5,7 +5,6 @@  from __future__ import absolute_import
 
 import os
 import re
-import sys
 import tempfile
 import xml.dom.minidom
 
@@ -164,8 +163,8 @@  def debugsvnlog(ui, **opts):
         raise error.Abort(_('debugsvnlog could not load Subversion python '
                            'bindings'))
 
-    args = decodeargs(sys.stdin.read())
-    get_log_child(sys.stdout, *args)
+    args = decodeargs(ui.fin.read())
+    get_log_child(ui.fout, *args)
 
 class logstream(object):
     """Interruptible revision log iterator."""