diff mercurial/commands.py @ 21237:0054a77f49df

localrepo: add "editor" argument to "tag()" Before this patch, "localrepository.tag()" doesn't take "editor" argument, and this prevents callers from passing "editor" argument to "localrepository.commit()" invoked internally. This patch adds "editor" argument to "localrepository.tag()" (and "_tag()", too), and makes "commands.tag()" invoke it with "editor" argument. This patch also omits explicit "localrepository.savecommitmesssage()" invocation, because "localrepository.commit()" will invoke specified "editor" and save edited commit message into ".hg/last-message.txt" automatically.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 05 May 2014 21:26:40 +0900
parents a1381eea7c7d
children edac098e6a55
line wrap: on
line diff
--- a/mercurial/commands.py	Mon May 05 21:26:40 2014 +0900
+++ b/mercurial/commands.py	Mon May 05 21:26:40 2014 +0900
@@ -5684,15 +5684,18 @@
             date = util.parsedate(date)
 
         if opts.get('edit'):
-            message = ui.edit(message, ui.username())
-            repo.savecommitmessage(message)
+            def editor(repo, ctx, subs):
+                return ui.edit(ctx.description() + "\n", ctx.user())
+        else:
+            editor = False
 
         # don't allow tagging the null rev
         if (not opts.get('remove') and
             scmutil.revsingle(repo, rev_).rev() == nullrev):
             raise util.Abort(_("cannot tag null revision"))
 
-        repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
+        repo.tag(names, r, message, opts.get('local'), opts.get('user'), date,
+                 editor=editor)
     finally:
         release(lock, wlock)