comparison mercurial/commands.py @ 4217:3be4785f8994

tags: add --remove
author Matt Mackall <mpm@selenic.com>
date Wed, 14 Mar 2007 19:13:04 -0500
parents 7e1c8a565a4f
children 5ccbc0be6cdb 281f9f8f1bd4
comparison
equal deleted inserted replaced
4216:6c0be67c2b27 4217:3be4785f8994
2437 if rev_ is not None: 2437 if rev_ is not None:
2438 ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, " 2438 ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, "
2439 "please use 'hg tag [-r REV] NAME' instead\n")) 2439 "please use 'hg tag [-r REV] NAME' instead\n"))
2440 if opts['rev']: 2440 if opts['rev']:
2441 raise util.Abort(_("use only one form to specify the revision")) 2441 raise util.Abort(_("use only one form to specify the revision"))
2442 if opts['rev'] and opts['remove']:
2443 raise util.Abort(_("--rev and --remove are incompatible"))
2442 if opts['rev']: 2444 if opts['rev']:
2443 rev_ = opts['rev'] 2445 rev_ = opts['rev']
2446 message = opts['message']
2447 if opts['remove']:
2448 rev_ = nullid
2449 if not message:
2450 message = _('Removed tag %s') % name
2444 if not rev_ and repo.dirstate.parents()[1] != nullid: 2451 if not rev_ and repo.dirstate.parents()[1] != nullid:
2445 raise util.Abort(_('uncommitted merge - please provide a ' 2452 raise util.Abort(_('uncommitted merge - please provide a '
2446 'specific revision')) 2453 'specific revision'))
2447 r = repo.changectx(rev_).node() 2454 r = repo.changectx(rev_).node()
2448 2455
2449 message = opts['message']
2450 if not message: 2456 if not message:
2451 message = _('Added tag %s for changeset %s') % (name, short(r)) 2457 message = _('Added tag %s for changeset %s') % (name, short(r))
2452 2458
2453 repo.tag(name, r, message, opts['local'], opts['user'], opts['date']) 2459 repo.tag(name, r, message, opts['local'], opts['user'], opts['date'])
2454 2460
2933 (tag, 2939 (tag,
2934 [('l', 'local', None, _('make the tag local')), 2940 [('l', 'local', None, _('make the tag local')),
2935 ('m', 'message', '', _('message for tag commit log entry')), 2941 ('m', 'message', '', _('message for tag commit log entry')),
2936 ('d', 'date', '', _('record datecode as commit date')), 2942 ('d', 'date', '', _('record datecode as commit date')),
2937 ('u', 'user', '', _('record user as commiter')), 2943 ('u', 'user', '', _('record user as commiter')),
2938 ('r', 'rev', '', _('revision to tag'))], 2944 ('r', 'rev', '', _('revision to tag')),
2945 ('', 'remove', None, _('remove a tag'))],
2939 _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')), 2946 _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
2940 "tags": (tags, [], _('hg tags')), 2947 "tags": (tags, [], _('hg tags')),
2941 "tip": 2948 "tip":
2942 (tip, 2949 (tip,
2943 [('b', 'branches', None, _('show branches (DEPRECATED)')), 2950 [('b', 'branches', None, _('show branches (DEPRECATED)')),