Comments
Patch
@@ -5568,8 +5568,8 @@
if opts.get('rev'):
rev_ = opts['rev']
message = opts.get('message')
+ expectedtype = opts.get('local') and 'local' or 'global'
if opts.get('remove'):
- expectedtype = opts.get('local') and 'local' or 'global'
for n in names:
if not repo.tagtype(n):
raise util.Abort(_("tag '%s' does not exist") % n)
@@ -5582,9 +5582,15 @@
if not message:
# we don't translate commit messages
message = 'Removed tag %s' % ', '.join(names)
- elif not opts.get('force'):
+ else:
for n in names:
- if n in repo.tags():
+ if n not in repo.tags():
+ continue
+ if (repo.tagtype(n) != expectedtype and
+ expectedtype == 'local'):
+ raise util.Abort(_("global tag '%s' can't be overwritten"
+ " locally") % n)
+ elif not opts.get('force'):
raise util.Abort(_("tag '%s' already exists "
"(use -f to force)") % n)
if not opts.get('local'):
@@ -99,6 +99,10 @@
$ cat .hg/localtags
d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
+ $ hg tag --local -r 1 bleah
+ abort: global tag 'bleah' can't be overwritten locally
+ [255]
+
tagging on a non-head revision
$ hg update 0