##// END OF EJS Templates
histedit: do not close stdin...
Jun Wu -
r28550:e2b9145e default
parent child Browse files
Show More
@@ -998,6 +998,13 b' def _getgoal(opts):'
998 998 return goaleditplan
999 999 return goalnew
1000 1000
1001 def _readfile(path):
1002 if path == '-':
1003 return sys.stdin.read()
1004 else:
1005 with open(path, 'rb') as f:
1006 return f.read()
1007
1001 1008 def _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs):
1002 1009 # TODO only abort if we try to histedit mq patches, not just
1003 1010 # blanket if mq patches are applied somewhere
@@ -1190,12 +1197,7 b' def _edithisteditplan(ui, repo, state, r'
1190 1197 node.short(state.topmost))
1191 1198 rules = ruleeditor(repo, ui, state.actions, comment)
1192 1199 else:
1193 if rules == '-':
1194 f = sys.stdin
1195 else:
1196 f = open(rules)
1197 rules = f.read()
1198 f.close()
1200 rules = _readfile(rules)
1199 1201 actions = parserules(rules, state)
1200 1202 ctxs = [repo[act.nodetoverify()] \
1201 1203 for act in state.actions if act.nodetoverify()]
@@ -1236,12 +1238,7 b' def _newhistedit(ui, repo, state, revs, '
1236 1238 actions = [pick(state, r) for r in revs]
1237 1239 rules = ruleeditor(repo, ui, actions, comment)
1238 1240 else:
1239 if rules == '-':
1240 f = sys.stdin
1241 else:
1242 f = open(rules)
1243 rules = f.read()
1244 f.close()
1241 rules = _readfile(rules)
1245 1242 actions = parserules(rules, state)
1246 1243 warnverifyactions(ui, repo, actions, state, ctxs)
1247 1244
General Comments 0
You need to be logged in to leave comments. Login now