Mercurial > hg
diff hgext/histedit.py @ 24141:671da7d34804
histedit: generalize makedesc
Allow makedesc to generate description for any action - not only pick.
(to be used in histedit --edit-plan)
author | Mateusz Kwapich <mitrandir@fb.com> |
---|---|
date | Thu, 22 Jan 2015 10:52:50 -0800 |
parents | 5a64b676c5d3 |
children | be7cb25186be |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Feb 23 10:57:27 2015 -0800 +++ b/hgext/histedit.py Thu Jan 22 10:52:50 2015 -0800 @@ -805,17 +805,18 @@ raise util.Abort(_('cannot edit immutable changeset: %s') % root) return [c.node() for c in ctxs] -def makedesc(c): - """build a initial action line for a ctx `c` +def makedesc(repo, action, rev): + """build a initial action line for a ctx line are in the form: - pick <hash> <rev> <summary> + <action> <hash> <rev> <summary> """ + ctx = repo[rev] summary = '' - if c.description(): - summary = c.description().splitlines()[0] - line = 'pick %s %d %s' % (c, c.rev(), summary) + if ctx.description(): + summary = ctx.description().splitlines()[0] + line = '%s %s %d %s' % (action, ctx, ctx.rev(), summary) # trim to 80 columns so it's not stupidly wide in my editor return util.ellipsis(line, 80) @@ -824,7 +825,7 @@ rules are in the format [ [act, ctx], ...] like in state.rules """ - rules = '\n'.join([makedesc(repo[rev]) for [act, rev] in rules]) + rules = '\n'.join([makedesc(repo, act, rev) for [act, rev] in rules]) rules += '\n\n' rules += editcomment rules = ui.edit(rules, ui.username())