diff mercurial/localrepo.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 9f3652e851f8
children 3b4c75690206
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon May 05 21:26:40 2014 +0900
+++ b/mercurial/localrepo.py	Mon May 05 21:26:40 2014 +0900
@@ -479,7 +479,8 @@
         return hook.hook(self.ui, self, name, throw, **args)
 
     @unfilteredmethod
-    def _tag(self, names, node, message, local, user, date, extra={}):
+    def _tag(self, names, node, message, local, user, date, extra={},
+             editor=False):
         if isinstance(names, str):
             names = (names,)
 
@@ -539,14 +540,15 @@
             self[None].add(['.hgtags'])
 
         m = matchmod.exact(self.root, '', ['.hgtags'])
-        tagnode = self.commit(message, user, date, extra=extra, match=m)
+        tagnode = self.commit(message, user, date, extra=extra, match=m,
+                              editor=editor)
 
         for name in names:
             self.hook('tag', node=hex(node), tag=name, local=local)
 
         return tagnode
 
-    def tag(self, names, node, message, local, user, date):
+    def tag(self, names, node, message, local, user, date, editor=False):
         '''tag a revision with one or more symbolic names.
 
         names is a list of strings or, when adding a single tag, names may be a
@@ -574,7 +576,7 @@
                                        '(please commit .hgtags manually)'))
 
         self.tags() # instantiate the cache
-        self._tag(names, node, message, local, user, date)
+        self._tag(names, node, message, local, user, date, editor=editor)
 
     @filteredpropertycache
     def _tagscache(self):