##// END OF EJS Templates
histedit: replace editcomment with a function
timeless -
r27673:d93d340d default
parent child Browse files
Show More
@@ -214,21 +214,32 class _constraints(object):
214 # leave the attribute unspecified.
214 # leave the attribute unspecified.
215 testedwith = 'internal'
215 testedwith = 'internal'
216
216
217 def geteditcomment(first, last):
218 """ construct the editor comment
219 The comment includes::
220 - an intro
221 - short commands
222
223 Commands are only included once.
224 """
225 intro = _("""Edit history between %s and %s
226
227 Commits are listed from least to most recent
228
229 Commands:""")
217 # i18n: command names and abbreviations must remain untranslated
230 # i18n: command names and abbreviations must remain untranslated
218 editcomment = _("""# Edit history between %s and %s
231 verbs = _("""
219 #
232 p, pick = use commit
220 # Commits are listed from least to most recent
233 e, edit = use commit, but stop for amending
221 #
234 f, fold = use commit, but combine it with the one above
222 # Commands:
235 r, roll = like fold, but discard this commit's description
223 # p, pick = use commit
236 d, drop = remove commit from history
224 # e, edit = use commit, but stop for amending
237 m, mess = edit commit message without changing commit content
225 # f, fold = use commit, but combine it with the one above
226 # r, roll = like fold, but discard this commit's description
227 # d, drop = remove commit from history
228 # m, mess = edit commit message without changing commit content
229 #
230 """)
238 """)
231
239
240 return ''.join(['# %s\n' % l if l else '#\n'
241 for l in ((intro % (first, last) + verbs).split('\n'))])
242
232 class histeditstate(object):
243 class histeditstate(object):
233 def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
244 def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
234 topmost=None, replacements=None, lock=None, wlock=None):
245 topmost=None, replacements=None, lock=None, wlock=None):
@@ -976,7 +987,7 def _histedit(ui, repo, state, *freeargs
976 elif goal == 'edit-plan':
987 elif goal == 'edit-plan':
977 state.read()
988 state.read()
978 if not rules:
989 if not rules:
979 comment = editcomment % (node.short(state.parentctxnode),
990 comment = geteditcomment(node.short(state.parentctxnode),
980 node.short(state.topmost))
991 node.short(state.topmost))
981 rules = ruleeditor(repo, ui, state.actions, comment)
992 rules = ruleeditor(repo, ui, state.actions, comment)
982 else:
993 else:
@@ -1059,7 +1070,7 def _histedit(ui, repo, state, *freeargs
1059
1070
1060 ctxs = [repo[r] for r in revs]
1071 ctxs = [repo[r] for r in revs]
1061 if not rules:
1072 if not rules:
1062 comment = editcomment % (node.short(root), node.short(topmost))
1073 comment = geteditcomment(node.short(root), node.short(topmost))
1063 actions = [pick(state, r) for r in revs]
1074 actions = [pick(state, r) for r in revs]
1064 rules = ruleeditor(repo, ui, actions, comment)
1075 rules = ruleeditor(repo, ui, actions, comment)
1065 else:
1076 else:
General Comments 0
You need to be logged in to leave comments. Login now