Mercurial > hg
changeset 7157:fd3cba5e73ae
mq: do not invoke editor until just before patch creation. Closes issue1346.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Sat, 18 Oct 2008 16:33:10 -0700 |
parents | 353141d74ca8 |
children | d1d011accf94 |
files | hgext/mq.py |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sat Oct 18 23:45:46 2008 +0200 +++ b/hgext/mq.py Sat Oct 18 16:33:10 2008 -0700 @@ -641,6 +641,9 @@ % name) def new(self, repo, patch, *pats, **opts): + """options: + msg: a string or a no-argument function returning a string + """ msg = opts.get('msg') force = opts.get('force') user = opts.get('user') @@ -661,6 +664,8 @@ wlock = repo.wlock() try: insert = self.full_series_end() + if callable(msg): + msg = msg() commitmsg = msg and msg or ("[mq]: %s" % patch) n = repo.commit(commitfiles, commitmsg, user, date, match=match, force=True) if n == None: @@ -1735,11 +1740,14 @@ -e, -m or -l set the patch header as well as the commit message. If none is specified, the patch header is empty and the commit message is '[mq]: PATCH'""" + msg = cmdutil.logmessage(opts) + def getmsg(): return ui.edit(msg, ui.username()) q = repo.mq - message = cmdutil.logmessage(opts) - if opts['edit']: - message = ui.edit(message, ui.username()) - opts['msg'] = message + opts['msg'] = msg + if opts.get('edit'): + opts['msg'] = getmsg + else: + opts['msg'] = msg setupheaderopts(ui, opts) q.new(repo, patch, *args, **opts) q.save_dirty()