# HG changeset patch # User Pierre-Yves David # Date 1318353777 -7200 # Node ID 6c3c7a18f079c533da69834032de67a4770c2654 # Parent 23c232a81fbe539bc0843a4c79f01e9b242702f7 propertly handle -m and -l option diff -r 23c232a81fbe -r 6c3c7a18f079 hgext/evolution.py --- 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]