# HG changeset patch # User FUJIWARA Katsunori # Date 1399736976 -32400 # Node ID d009f6555b8152158c30bf32c47aace18dda2e26 # Parent 272785489ed313e898c1ec573e40eb5c3ec75f57 mq: fold the code path to invoke editor into specific logic (qnew) This factoring simplifies the succeeding patch to switch from "ui.edit()" to "getcommiteditor()" for qnew. diff -r 272785489ed3 -r d009f6555b81 hgext/mq.py --- a/hgext/mq.py Sun May 11 00:49:36 2014 +0900 +++ b/hgext/mq.py Sun May 11 00:49:36 2014 +0900 @@ -1026,7 +1026,7 @@ msg: a string or a no-argument function returning a string """ msg = opts.get('msg') - editor = opts.get('editor') + edit = opts.get('edit') user = opts.get('user') date = opts.get('date') if date: @@ -1081,10 +1081,11 @@ p.write("# Date %s %s\n\n" % date) 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(): return desc else: @@ -2442,10 +2443,6 @@ msg = cmdutil.logmessage(ui, opts) q = repo.mq opts['msg'] = msg - if opts.get('edit'): - def editor(repo, ctx, subs): - return ui.edit(ctx.description() + "\n", ctx.user()) - opts['editor'] = editor setupheaderopts(ui, opts) q.new(repo, patch, *args, **opts) q.savedirty()