Show More
@@ -3209,6 +3209,9 b' def tag(ui, repo, name1, *names, **opts)' | |||||
3209 | shared among repositories). |
|
3209 | shared among repositories). | |
3210 |
|
3210 | |||
3211 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
3211 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
|
3212 | ||||
|
3213 | Since tag names have priority over branch names during revision | |||
|
3214 | lookup, using an existing branch name as a tag name is discouraged. | |||
3212 | """ |
|
3215 | """ | |
3213 |
|
3216 | |||
3214 | rev_ = "." |
|
3217 | rev_ = "." |
@@ -164,9 +164,13 b' class localrepository(repo.repository):' | |||||
164 | if c in allchars: |
|
164 | if c in allchars: | |
165 | raise util.Abort(_('%r cannot be used in a tag name') % c) |
|
165 | raise util.Abort(_('%r cannot be used in a tag name') % c) | |
166 |
|
166 | |||
|
167 | branches = self.branchmap() | |||
167 | for name in names: |
|
168 | for name in names: | |
168 | self.hook('pretag', throw=True, node=hex(node), tag=name, |
|
169 | self.hook('pretag', throw=True, node=hex(node), tag=name, | |
169 | local=local) |
|
170 | local=local) | |
|
171 | if name in branches: | |||
|
172 | self.ui.warn(_("warning: tag %s conflicts with existing" | |||
|
173 | " branch name\n") % name) | |||
170 |
|
174 | |||
171 | def writetags(fp, names, munge, prevtags): |
|
175 | def writetags(fp, names, munge, prevtags): | |
172 | fp.seek(0, 2) |
|
176 | fp.seek(0, 2) |
@@ -68,3 +68,8 b" hg ci -d '1000000 0' -m'broken manual ed" | |||||
68 | cat .hgtags |
|
68 | cat .hgtags | |
69 | hg tag -d '1000000 0' newline |
|
69 | hg tag -d '1000000 0' newline | |
70 | cat .hgtags |
|
70 | cat .hgtags | |
|
71 | ||||
|
72 | echo % tag and branch using same name | |||
|
73 | hg branch tag-and-branch-same-name | |||
|
74 | hg ci -m"discouraged" | |||
|
75 | hg tag tag-and-branch-same-name |
@@ -94,3 +94,6 b' 3ecf002a1c572a2f3bb4e665417e60fca65bbd42' | |||||
94 | f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline |
|
94 | f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline | |
95 | 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar |
|
95 | 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar | |
96 | 6ae703d793c8b1f097116869275ecd97b2977a2b newline |
|
96 | 6ae703d793c8b1f097116869275ecd97b2977a2b newline | |
|
97 | % tag and branch using same name | |||
|
98 | marked working directory as branch tag-and-branch-same-name | |||
|
99 | warning: tag tag-and-branch-same-name conflicts with existing branch name |
General Comments 0
You need to be logged in to leave comments.
Login now