Mercurial > evolve
changeset 104:6c3c7a18f079
propertly handle -m and -l option
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 11 Oct 2011 19:22:57 +0200 |
parents | 23c232a81fbe |
children | 6300dd1c2df7 |
files | hgext/evolution.py |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolution.py Tue Oct 11 19:22:41 2011 +0200 +++ b/hgext/evolution.py Tue Oct 11 19:22:57 2011 +0200 @@ -78,9 +78,19 @@ if path in headmf: return head.filectx(path) raise IOError() + if commitopts.get('message') and commitopts.get('logfile'): + raise util.Abort(_('options --message and --logfile are mutually' + ' exclusive')) + if commitopts.get('logfile'): + message= open(commitopts['logfile']).read() + elif commitopts.get('message'): + message = commitopts['message'] + else: + message = old.description() + new = context.memctx(repo, parents=newbases, - text=commitopts.get('message') or old.description(), + text=message, files=files, filectxfn=filectxfn, user=commitopts.get('user') or None, @@ -257,6 +267,8 @@ # commit current changes as update # code copied from commands.commit to avoid noisy messages ciopts = dict(opts) + ciopts.pop('message', None) + ciopts.pop('logfile', None) ciopts['message'] = opts.get('note') or ('amends %s' % old.hex()) e = cmdutil.commiteditor if ciopts.get('force_editor'): @@ -272,7 +284,7 @@ updatenodes = set(cl.nodesbetween(roots=[old.node()], heads=[head.node()])[0]) updatenodes.remove(old.node()) - if not updatenodes: + if not updatenodes and not (opts.get('message') or opts.get('logfile')): raise error.Abort(_('no updates found')) updates = [repo[n] for n in updatenodes]