##// END OF EJS Templates
histedit: use ui.fin to read commands from stdin...
Yuya Nishihara -
r30262:bc5d0e6f default
parent child Browse files
Show More
@@ -173,7 +173,6 b' from __future__ import absolute_import'
173
173
174 import errno
174 import errno
175 import os
175 import os
176 import sys
177
176
178 from mercurial.i18n import _
177 from mercurial.i18n import _
179 from mercurial import (
178 from mercurial import (
@@ -991,9 +990,9 b' def _getgoal(opts):'
991 return goaleditplan
990 return goaleditplan
992 return goalnew
991 return goalnew
993
992
994 def _readfile(path):
993 def _readfile(ui, path):
995 if path == '-':
994 if path == '-':
996 return sys.stdin.read()
995 return ui.fin.read()
997 else:
996 else:
998 with open(path, 'rb') as f:
997 with open(path, 'rb') as f:
999 return f.read()
998 return f.read()
@@ -1191,7 +1190,7 b' def _edithisteditplan(ui, repo, state, r'
1191 node.short(state.topmost))
1190 node.short(state.topmost))
1192 rules = ruleeditor(repo, ui, state.actions, comment)
1191 rules = ruleeditor(repo, ui, state.actions, comment)
1193 else:
1192 else:
1194 rules = _readfile(rules)
1193 rules = _readfile(ui, rules)
1195 actions = parserules(rules, state)
1194 actions = parserules(rules, state)
1196 ctxs = [repo[act.node] \
1195 ctxs = [repo[act.node] \
1197 for act in state.actions if act.node]
1196 for act in state.actions if act.node]
@@ -1232,7 +1231,7 b' def _newhistedit(ui, repo, state, revs, '
1232 actions = [pick(state, r) for r in revs]
1231 actions = [pick(state, r) for r in revs]
1233 rules = ruleeditor(repo, ui, actions, comment)
1232 rules = ruleeditor(repo, ui, actions, comment)
1234 else:
1233 else:
1235 rules = _readfile(rules)
1234 rules = _readfile(ui, rules)
1236 actions = parserules(rules, state)
1235 actions = parserules(rules, state)
1237 warnverifyactions(ui, repo, actions, state, ctxs)
1236 warnverifyactions(ui, repo, actions, state, ctxs)
1238
1237
@@ -135,6 +135,19 b' typical client does not want echo-back m'
135 summary: 1
135 summary: 1
136
136
137
137
138 check that "histedit --commands=-" can read rules from the input channel:
139
140 >>> import cStringIO
141 >>> from hgclient import readchannel, runcommand, check
142 >>> @check
143 ... def serverinput(server):
144 ... readchannel(server)
145 ... rules = 'pick eff892de26ec\n'
146 ... runcommand(server, ['histedit', '0', '--commands=-',
147 ... '--config', 'extensions.histedit='],
148 ... input=cStringIO.StringIO(rules))
149 *** runcommand histedit 0 --commands=- --config extensions.histedit=
150
138 check that --cwd doesn't persist between requests:
151 check that --cwd doesn't persist between requests:
139
152
140 $ mkdir foo
153 $ mkdir foo
General Comments 0
You need to be logged in to leave comments. Login now