diff hgext/histedit.py @ 30262:bc5d0e6fd9f3

histedit: use ui.fin to read commands from stdin stdin is wrapped by channeledinput in command-server session.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 18 Mar 2016 17:15:06 -0700
parents 4d9999e43ff7
children 318a24b52eeb
line wrap: on
line diff
--- a/hgext/histedit.py	Sat Oct 03 14:34:56 2015 +0900
+++ b/hgext/histedit.py	Fri Mar 18 17:15:06 2016 -0700
@@ -173,7 +173,6 @@
 
 import errno
 import os
-import sys
 
 from mercurial.i18n import _
 from mercurial import (
@@ -991,9 +990,9 @@
         return goaleditplan
     return goalnew
 
-def _readfile(path):
+def _readfile(ui, path):
     if path == '-':
-        return sys.stdin.read()
+        return ui.fin.read()
     else:
         with open(path, 'rb') as f:
             return f.read()
@@ -1191,7 +1190,7 @@
                                  node.short(state.topmost))
         rules = ruleeditor(repo, ui, state.actions, comment)
     else:
-        rules = _readfile(rules)
+        rules = _readfile(ui, rules)
     actions = parserules(rules, state)
     ctxs = [repo[act.node] \
             for act in state.actions if act.node]
@@ -1232,7 +1231,7 @@
         actions = [pick(state, r) for r in revs]
         rules = ruleeditor(repo, ui, actions, comment)
     else:
-        rules = _readfile(rules)
+        rules = _readfile(ui, rules)
     actions = parserules(rules, state)
     warnverifyactions(ui, repo, actions, state, ctxs)