diff mercurial/localrepo.py @ 11063:eb23c876c111

tag: warn users about tag/branch possible name conflicts As reported recently, Mercurial users can easily find confusion when using a common name for a tag and a branch. It seems reasonable to warn them about this potential outcome, to avoid that "surprise". * Explain briefly the issue in "hg help tag" * Warn when tagging a revision
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 19 Apr 2010 17:41:12 +0900
parents c7dbd6c4877a
children 4a9bee613737
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Apr 19 11:31:19 2010 +0200
+++ b/mercurial/localrepo.py	Mon Apr 19 17:41:12 2010 +0900
@@ -164,9 +164,13 @@
             if c in allchars:
                 raise util.Abort(_('%r cannot be used in a tag name') % c)
 
+        branches = self.branchmap()
         for name in names:
             self.hook('pretag', throw=True, node=hex(node), tag=name,
                       local=local)
+            if name in branches:
+                self.ui.warn(_("warning: tag %s conflicts with existing"
+                " branch name\n") % name)
 
         def writetags(fp, names, munge, prevtags):
             fp.seek(0, 2)