edit option \o/
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 29 Dec 2011 03:09:21 +0100
changeset 118 06fe05256a79
parent 117 438fe133b068
child 119 22f2b700bd59
edit option \o/
hgext/evolution.py
--- a/hgext/evolution.py	Wed Dec 28 13:10:24 2011 +0100
+++ b/hgext/evolution.py	Thu Dec 29 03:09:21 2011 +0100
@@ -90,6 +90,8 @@
         else:
             message = old.description()
 
+
+
         new = context.memctx(repo,
                              parents=newbases,
                              text=message,
@@ -98,6 +100,9 @@
                              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 @@
         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 @@
         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)