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

Yuya Nishihara yuya at tcha.org
Wed Nov 2 08:02:14 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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."""


More information about the Mercurial-devel mailing list