##// END OF EJS Templates
histedit: use torule instead of makedesc in ruleeditor
Mateusz Kwapich -
r27204:6b77e749 default
parent child Browse files
Show More
@@ -939,7 +939,7 b' def _histedit(ui, repo, state, *freeargs'
939 if not rules:
939 if not rules:
940 comment = editcomment % (node.short(state.parentctxnode),
940 comment = editcomment % (node.short(state.parentctxnode),
941 node.short(state.topmost))
941 node.short(state.topmost))
942 rules = ruleeditor(repo, ui, state.rules, comment)
942 rules = ruleeditor(repo, ui, state.actions, comment)
943 else:
943 else:
944 if rules == '-':
944 if rules == '-':
945 f = sys.stdin
945 f = sys.stdin
@@ -1022,7 +1022,8 b' def _histedit(ui, repo, state, *freeargs'
1022 ctxs = [repo[r] for r in revs]
1022 ctxs = [repo[r] for r in revs]
1023 if not rules:
1023 if not rules:
1024 comment = editcomment % (node.short(root), node.short(topmost))
1024 comment = editcomment % (node.short(root), node.short(topmost))
1025 rules = ruleeditor(repo, ui, [['pick', c] for c in ctxs], comment)
1025 actions = [pick(state, r) for r in revs]
1026 rules = ruleeditor(repo, ui, actions, comment)
1026 else:
1027 else:
1027 if rules == '-':
1028 if rules == '-':
1028 f = sys.stdin
1029 f = sys.stdin
@@ -1161,12 +1162,12 b' def makedesc(repo, action, rev):'
1161 maxlen = max(maxlen, 22) # avoid truncating hash
1162 maxlen = max(maxlen, 22) # avoid truncating hash
1162 return util.ellipsis(line, maxlen)
1163 return util.ellipsis(line, maxlen)
1163
1164
1164 def ruleeditor(repo, ui, rules, editcomment=""):
1165 def ruleeditor(repo, ui, actions, editcomment=""):
1165 """open an editor to edit rules
1166 """open an editor to edit rules
1166
1167
1167 rules are in the format [ [act, ctx], ...] like in state.rules
1168 rules are in the format [ [act, ctx], ...] like in state.rules
1168 """
1169 """
1169 rules = '\n'.join([makedesc(repo, act, rev) for [act, rev] in rules])
1170 rules = '\n'.join([act.torule() for act in actions])
1170 rules += '\n\n'
1171 rules += '\n\n'
1171 rules += editcomment
1172 rules += editcomment
1172 rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})
1173 rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})
General Comments 0
You need to be logged in to leave comments. Login now