changeset 15220:f7db54b832af

transplant: add --edit option
author Matt Mackall <mpm@selenic.com>
date Mon, 10 Oct 2011 23:07:09 -0500
parents 9d58569a8b92
children 269374b89b74
files hgext/transplant.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/transplant.py	Mon Oct 10 23:01:25 2011 -0500
+++ b/hgext/transplant.py	Mon Oct 10 23:07:09 2011 -0500
@@ -81,6 +81,7 @@
         self.opener = scmutil.opener(self.path)
         self.transplants = transplants(self.path, 'transplants',
                                        opener=self.opener)
+        self.editor = None
 
     def applied(self, repo, node, parent):
         '''returns True if a node is already an ancestor of parent
@@ -257,7 +258,8 @@
         else:
             m = match.exact(repo.root, '', files)
 
-        n = repo.commit(message, user, date, extra=extra, match=m)
+        n = repo.commit(message, user, date, extra=extra, match=m,
+                        editor=self.editor)
         if not n:
             # Crash here to prevent an unclear crash later, in
             # transplants.write().  This can happen if patch.patch()
@@ -308,7 +310,8 @@
                                  revlog.hex(parents[0]))
             if merge:
                 repo.dirstate.setparents(p1, parents[1])
-            n = repo.commit(message, user, date, extra=extra)
+            n = repo.commit(message, user, date, extra=extra,
+                            editor=self.editor)
             if not n:
                 raise util.Abort(_('commit failed'))
             if not merge:
@@ -465,6 +468,7 @@
     ('a', 'all', None, _('pull all changesets up to BRANCH')),
     ('p', 'prune', [], _('skip over REV'), _('REV')),
     ('m', 'merge', [], _('merge at REV'), _('REV')),
+    ('e', 'edit', False, _('invoke editor on commit messages')),
     ('', 'log', None, _('append transplant info to log message')),
     ('c', 'continue', None, _('continue last transplant session '
                               'after repair')),
@@ -553,6 +557,8 @@
         opts['filter'] = ui.config('transplant', 'filter')
 
     tp = transplanter(ui, repo)
+    if opts.get('edit'):
+        tp.editor = cmdutil.commitforceeditor
 
     p1, p2 = repo.dirstate.parents()
     if len(repo) > 0 and p1 == revlog.nullid: