##// 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 939 if not rules:
940 940 comment = editcomment % (node.short(state.parentctxnode),
941 941 node.short(state.topmost))
942 rules = ruleeditor(repo, ui, state.rules, comment)
942 rules = ruleeditor(repo, ui, state.actions, comment)
943 943 else:
944 944 if rules == '-':
945 945 f = sys.stdin
@@ -1022,7 +1022,8 b' def _histedit(ui, repo, state, *freeargs'
1022 1022 ctxs = [repo[r] for r in revs]
1023 1023 if not rules:
1024 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 1027 else:
1027 1028 if rules == '-':
1028 1029 f = sys.stdin
@@ -1161,12 +1162,12 b' def makedesc(repo, action, rev):'
1161 1162 maxlen = max(maxlen, 22) # avoid truncating hash
1162 1163 return util.ellipsis(line, maxlen)
1163 1164
1164 def ruleeditor(repo, ui, rules, editcomment=""):
1165 def ruleeditor(repo, ui, actions, editcomment=""):
1165 1166 """open an editor to edit rules
1166 1167
1167 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 1171 rules += '\n\n'
1171 1172 rules += editcomment
1172 1173 rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})
General Comments 0
You need to be logged in to leave comments. Login now