Mercurial > hg
changeset 21422:edc6ced48d2d
mq: fold the code paths to invoke editor into specific logic (qrefresh/qfold)
This factoring simplifies the succeeding patch to switch from
"ui.edit()" to "getcommiteditor()" for qrefresh/qfold.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 11 May 2014 00:49:36 +0900 |
parents | 4941caa9f0f8 |
children | 7d408720453d |
files | hgext/mq.py |
diffstat | 1 files changed, 7 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sun May 11 00:49:36 2014 +0900 +++ b/hgext/mq.py Sun May 11 00:49:36 2014 +0900 @@ -1486,7 +1486,7 @@ self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() - editor = opts.get('editor') + edit = opts.get('edit') newuser = opts.get('user') newdate = opts.get('date') if newdate: @@ -1656,10 +1656,11 @@ # might be nice to attempt to roll back strip after this defaultmsg = "[mq]: %s" % patchfn - if editor: - origeditor = editor + editor = False + if edit: def desceditor(repo, ctx, subs): - desc = origeditor(repo, ctx, subs) + desc = self.ui.edit(ctx.description() + "\n", + ctx.user()) if desc.rstrip(): ph.setmessage(desc) return desc @@ -2490,14 +2491,10 @@ if opts.get('edit'): if message: raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) - def editor(repo, ctx, subs): - return ui.edit(ctx.description() + "\n", ctx.user()) - else: - editor = False setupheaderopts(ui, opts) wlock = repo.wlock() try: - ret = q.refresh(repo, pats, msg=message, editor=editor, **opts) + ret = q.refresh(repo, pats, msg=message, **opts) q.savedirty() return ret finally: @@ -2587,16 +2584,10 @@ message.extend(msg) message = '\n'.join(message) - if opts.get('edit'): - def editor(repo, ctx, subs): - return ui.edit(ctx.description() + "\n", ctx.user()) - else: - editor = False - diffopts = q.patchopts(q.diffopts(), *patches) wlock = repo.wlock() try: - q.refresh(repo, msg=message, git=diffopts.git, editor=editor) + q.refresh(repo, msg=message, git=diffopts.git, edit=opts.get('edit')) q.delete(repo, patches, opts) q.savedirty() finally: