Mercurial > hg
comparison mercurial/commands.py @ 13136:6320101a638c
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 14 Dec 2010 17:10:01 -0600 |
parents | 8c6b7a5f38c4 1c1ca9d393f4 |
children | 1aea66b71f4f |
comparison
equal
deleted
inserted
replaced
13132:24e3349cba8e | 13136:6320101a638c |
---|---|
3663 | 3663 |
3664 Name a particular revision using <name>. | 3664 Name a particular revision using <name>. |
3665 | 3665 |
3666 Tags are used to name particular revisions of the repository and are | 3666 Tags are used to name particular revisions of the repository and are |
3667 very useful to compare different revisions, to go back to significant | 3667 very useful to compare different revisions, to go back to significant |
3668 earlier versions or to mark branch points as releases, etc. | 3668 earlier versions or to mark branch points as releases, etc. Changing |
3669 an existing tag is normally disallowed; use -f/--force to override. | |
3669 | 3670 |
3670 If no revision is given, the parent of the working directory is | 3671 If no revision is given, the parent of the working directory is |
3671 used, or tip if no revision is checked out. | 3672 used, or tip if no revision is checked out. |
3672 | 3673 |
3673 To facilitate version control, distribution, and merging of tags, | 3674 To facilitate version control, distribution, and merging of tags, |
3674 they are stored as a file named ".hgtags" which is managed | 3675 they are stored as a file named ".hgtags" which is managed similarly |
3675 similarly to other project files and can be hand-edited if | 3676 to other project files and can be hand-edited if necessary. This |
3676 necessary. The file '.hg/localtags' is used for local tags (not | 3677 also means that tagging creates a new commit. The file |
3677 shared among repositories). | 3678 ".hg/localtags" is used for local tags (not shared among |
3679 repositories). | |
3680 | |
3681 Tag commits are usually made at the head of a branch. If the parent | |
3682 of the working directory is not a branch head, :hg:`tag` aborts; use | |
3683 -f/--force to force the tag commit to be based on a non-head | |
3684 changeset. | |
3678 | 3685 |
3679 See :hg:`help dates` for a list of formats valid for -d/--date. | 3686 See :hg:`help dates` for a list of formats valid for -d/--date. |
3680 | 3687 |
3681 Since tag names have priority over branch names during revision | 3688 Since tag names have priority over branch names during revision |
3682 lookup, using an existing branch name as a tag name is discouraged. | 3689 lookup, using an existing branch name as a tag name is discouraged. |
3715 elif not opts.get('force'): | 3722 elif not opts.get('force'): |
3716 for n in names: | 3723 for n in names: |
3717 if n in repo.tags(): | 3724 if n in repo.tags(): |
3718 raise util.Abort(_('tag \'%s\' already exists ' | 3725 raise util.Abort(_('tag \'%s\' already exists ' |
3719 '(use -f to force)') % n) | 3726 '(use -f to force)') % n) |
3720 if not rev_ and repo.dirstate.parents()[1] != nullid: | 3727 if not opts.get('local'): |
3721 raise util.Abort(_('uncommitted merge - please provide a ' | 3728 p1, p2 = repo.dirstate.parents() |
3722 'specific revision')) | 3729 if p2 != nullid: |
3730 raise util.Abort(_('uncommitted merge')) | |
3731 bheads = repo.branchheads() | |
3732 if not opts.get('force') and bheads and p1 not in bheads: | |
3733 raise util.Abort(_('not at a branch head (use -f to force)')) | |
3723 r = cmdutil.revsingle(repo, rev_).node() | 3734 r = cmdutil.revsingle(repo, rev_).node() |
3724 | 3735 |
3725 if not message: | 3736 if not message: |
3726 # we don't translate commit messages | 3737 # we don't translate commit messages |
3727 message = ('Added tag %s for changeset %s' % | 3738 message = ('Added tag %s for changeset %s' % |
4479 _('list the changed files of a revision'), _('REV')), | 4490 _('list the changed files of a revision'), _('REV')), |
4480 ] + walkopts + subrepoopts, | 4491 ] + walkopts + subrepoopts, |
4481 _('[OPTION]... [FILE]...')), | 4492 _('[OPTION]... [FILE]...')), |
4482 "tag": | 4493 "tag": |
4483 (tag, | 4494 (tag, |
4484 [('f', 'force', None, _('replace existing tag')), | 4495 [('f', 'force', None, _('force tag')), |
4485 ('l', 'local', None, _('make the tag local')), | 4496 ('l', 'local', None, _('make the tag local')), |
4486 ('r', 'rev', '', | 4497 ('r', 'rev', '', |
4487 _('revision to tag'), _('REV')), | 4498 _('revision to tag'), _('REV')), |
4488 ('', 'remove', None, _('remove a tag')), | 4499 ('', 'remove', None, _('remove a tag')), |
4489 # -l/--local is already there, commitopts cannot be used | 4500 # -l/--local is already there, commitopts cannot be used |