site

(Pierre-Yves David)
2011-12-29: edit option \o/

edit option \o/

diff --git a/hgext/evolution.py b/hgext/evolution.py
--- a/hgext/evolution.py
+++ b/hgext/evolution.py
@@ -90,6 +90,8 @@ def rewrite(repo, old, updates, head, ne
         else:
             message = old.description()
 
+
+
         new = context.memctx(repo,
                              parents=newbases,
                              text=message,
@@ -98,6 +100,9 @@ def rewrite(repo, old, updates, head, ne
                              user=commitopts.get('user') or None,
                              date=commitopts.get('date') or None,
                              extra=commitopts.get('extra') or None)
+
+        if commitopts.get('edit'):
+            new._text = cmdutil.commitforceeditor(repo, new, [])
         newid = repo.commitctx(new)
         new = repo[newid]
 
@@ -276,8 +281,6 @@ def amend(ui, repo, *pats, **opts):
         ciopts.pop('logfile', None)
         ciopts['message'] = opts.get('note') or ('amends %s' % old.hex())
         e = cmdutil.commiteditor
-        if ciopts.get('edit'):
-            e = cmdutil.commitforceeditor
         def commitfunc(ui, repo, message, match, opts):
             return repo.commit(message, opts.get('user'), opts.get('date'), match,
                                editor=e)
@@ -289,11 +292,13 @@ def amend(ui, repo, *pats, **opts):
         updatenodes = set(cl.nodesbetween(roots=[old.node()],
                                           heads=[head.node()])[0])
         updatenodes.remove(old.node())
-        if not updatenodes and not (opts.get('message') or opts.get('logfile')):
+        if not updatenodes and not (opts.get('message') or opts.get('logfile') or opts.get('edit')):
             raise error.Abort(_('no updates found'))
         updates = [repo[n] for n in updatenodes]
 
         # perform amend
+        if opts.get('edit'):
+            opts['force_editor'] = True
         newid = rewrite(repo, old, updates, head,
                         [old.p1().node(), old.p2().node()], opts)