Show More
@@ -7478,7 +7478,7 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
7478 | 7478 | Returns 0 on success. |
|
7479 | 7479 | """ |
|
7480 | 7480 | cmdutil.check_incompatible_arguments(opts, 'remove', ['rev']) |
|
7481 | opts = pycompat.byteskwargs(opts) | |
|
7481 | ||
|
7482 | 7482 | with repo.wlock(), repo.lock(): |
|
7483 | 7483 | rev_ = b"." |
|
7484 | 7484 | names = [t.strip() for t in (name1,) + names] |
@@ -7490,11 +7490,11 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
7490 | 7490 | raise error.InputError( |
|
7491 | 7491 | _(b'tag names cannot consist entirely of whitespace') |
|
7492 | 7492 | ) |
|
7493 |
if opts.get( |
|
|
7494 |
rev_ = opts[ |
|
|
7495 |
message = opts.get( |
|
|
7496 |
if opts.get( |
|
|
7497 |
if opts.get( |
|
|
7493 | if opts.get('rev'): | |
|
7494 | rev_ = opts['rev'] | |
|
7495 | message = opts.get('message') | |
|
7496 | if opts.get('remove'): | |
|
7497 | if opts.get('local'): | |
|
7498 | 7498 | expectedtype = b'local' |
|
7499 | 7499 | else: |
|
7500 | 7500 | expectedtype = b'global' |
@@ -7521,18 +7521,18 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
7521 | 7521 | if not message: |
|
7522 | 7522 | # we don't translate commit messages |
|
7523 | 7523 | message = b'Removed tag %s' % b', '.join(names) |
|
7524 |
elif not opts.get( |
|
|
7524 | elif not opts.get('force'): | |
|
7525 | 7525 | for n in names: |
|
7526 | 7526 | if n in repo.tags(): |
|
7527 | 7527 | raise error.InputError( |
|
7528 | 7528 | _(b"tag '%s' already exists (use -f to force)") % n |
|
7529 | 7529 | ) |
|
7530 |
if not opts.get( |
|
|
7530 | if not opts.get('local'): | |
|
7531 | 7531 | p1, p2 = repo.dirstate.parents() |
|
7532 | 7532 | if p2 != repo.nullid: |
|
7533 | 7533 | raise error.StateError(_(b'uncommitted merge')) |
|
7534 | 7534 | bheads = repo.branchheads() |
|
7535 |
if not opts.get( |
|
|
7535 | if not opts.get('force') and bheads and p1 not in bheads: | |
|
7536 | 7536 | raise error.InputError( |
|
7537 | 7537 | _( |
|
7538 | 7538 | b'working directory is not at a branch head ' |
@@ -7544,7 +7544,7 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
7544 | 7544 | # don't allow tagging the null rev or the working directory |
|
7545 | 7545 | if node is None: |
|
7546 | 7546 | raise error.InputError(_(b"cannot tag working directory")) |
|
7547 |
elif not opts.get( |
|
|
7547 | elif not opts.get('remove') and node == nullid: | |
|
7548 | 7548 | raise error.InputError(_(b"cannot tag null revision")) |
|
7549 | 7549 | |
|
7550 | 7550 | if not message: |
@@ -7554,25 +7554,23 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
7554 | 7554 | short(node), |
|
7555 | 7555 | ) |
|
7556 | 7556 | |
|
7557 |
date = opts.get( |
|
|
7557 | date = opts.get('date') | |
|
7558 | 7558 | if date: |
|
7559 | 7559 | date = dateutil.parsedate(date) |
|
7560 | 7560 | |
|
7561 |
if opts.get( |
|
|
7561 | if opts.get('remove'): | |
|
7562 | 7562 | editform = b'tag.remove' |
|
7563 | 7563 | else: |
|
7564 | 7564 | editform = b'tag.add' |
|
7565 | editor = cmdutil.getcommiteditor( | |
|
7566 | editform=editform, **pycompat.strkwargs(opts) | |
|
7567 | ) | |
|
7565 | editor = cmdutil.getcommiteditor(editform=editform, **opts) | |
|
7568 | 7566 | |
|
7569 | 7567 | tagsmod.tag( |
|
7570 | 7568 | repo, |
|
7571 | 7569 | names, |
|
7572 | 7570 | node, |
|
7573 | 7571 | message, |
|
7574 |
opts.get( |
|
|
7575 |
opts.get( |
|
|
7572 | opts.get('local'), | |
|
7573 | opts.get('user'), | |
|
7576 | 7574 | date, |
|
7577 | 7575 | editor=editor, |
|
7578 | 7576 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now