2443 if rev_ is not None: |
2443 if rev_ is not None: |
2444 ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, " |
2444 ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, " |
2445 "please use 'hg tag [-r REV] NAME' instead\n")) |
2445 "please use 'hg tag [-r REV] NAME' instead\n")) |
2446 if opts['rev']: |
2446 if opts['rev']: |
2447 raise util.Abort(_("use only one form to specify the revision")) |
2447 raise util.Abort(_("use only one form to specify the revision")) |
|
2448 if opts['rev'] and opts['remove']: |
|
2449 raise util.Abort(_("--rev and --remove are incompatible")) |
2448 if opts['rev']: |
2450 if opts['rev']: |
2449 rev_ = opts['rev'] |
2451 rev_ = opts['rev'] |
|
2452 message = opts['message'] |
|
2453 if opts['remove']: |
|
2454 rev_ = nullid |
|
2455 if not message: |
|
2456 message = _('Removed tag %s') % name |
2450 if not rev_ and repo.dirstate.parents()[1] != nullid: |
2457 if not rev_ and repo.dirstate.parents()[1] != nullid: |
2451 raise util.Abort(_('uncommitted merge - please provide a ' |
2458 raise util.Abort(_('uncommitted merge - please provide a ' |
2452 'specific revision')) |
2459 'specific revision')) |
2453 r = repo.changectx(rev_).node() |
2460 r = repo.changectx(rev_).node() |
2454 |
2461 |
2455 message = opts['message'] |
|
2456 if not message: |
2462 if not message: |
2457 message = _('Added tag %s for changeset %s') % (name, short(r)) |
2463 message = _('Added tag %s for changeset %s') % (name, short(r)) |
2458 |
2464 |
2459 repo.tag(name, r, message, opts['local'], opts['user'], opts['date']) |
2465 repo.tag(name, r, message, opts['local'], opts['user'], opts['date']) |
2460 |
2466 |
2911 (tag, |
2917 (tag, |
2912 [('l', 'local', None, _('make the tag local')), |
2918 [('l', 'local', None, _('make the tag local')), |
2913 ('m', 'message', '', _('message for tag commit log entry')), |
2919 ('m', 'message', '', _('message for tag commit log entry')), |
2914 ('d', 'date', '', _('record datecode as commit date')), |
2920 ('d', 'date', '', _('record datecode as commit date')), |
2915 ('u', 'user', '', _('record user as commiter')), |
2921 ('u', 'user', '', _('record user as commiter')), |
2916 ('r', 'rev', '', _('revision to tag'))], |
2922 ('r', 'rev', '', _('revision to tag')), |
|
2923 ('', 'remove', None, _('remove a tag'))], |
2917 _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')), |
2924 _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')), |
2918 "tags": (tags, [], _('hg tags')), |
2925 "tags": (tags, [], _('hg tags')), |
2919 "tip": |
2926 "tip": |
2920 (tip, |
2927 (tip, |
2921 [('', 'style', '', _('display using template map file')), |
2928 [('', 'style', '', _('display using template map file')), |