Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGbb141aa54728: tag: avoid using "r" variable name for nodeid
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (6 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
if not opts.get('local'): | if not opts.get('local'): | ||||
p1, p2 = repo.dirstate.parents() | p1, p2 = repo.dirstate.parents() | ||||
if p2 != nullid: | if p2 != nullid: | ||||
raise error.Abort(_('uncommitted merge')) | raise error.Abort(_('uncommitted merge')) | ||||
bheads = repo.branchheads() | bheads = repo.branchheads() | ||||
if not opts.get('force') and bheads and p1 not in bheads: | if not opts.get('force') and bheads and p1 not in bheads: | ||||
raise error.Abort(_('working directory is not at a branch head ' | raise error.Abort(_('working directory is not at a branch head ' | ||||
'(use -f to force)')) | '(use -f to force)')) | ||||
r = scmutil.revsingle(repo, rev_).node() | node = scmutil.revsingle(repo, rev_).node() | ||||
if not message: | if not message: | ||||
# we don't translate commit messages | # we don't translate commit messages | ||||
message = ('Added tag %s for changeset %s' % | message = ('Added tag %s for changeset %s' % | ||||
(', '.join(names), short(r))) | (', '.join(names), short(node))) | ||||
date = opts.get('date') | date = opts.get('date') | ||||
if date: | if date: | ||||
date = dateutil.parsedate(date) | date = dateutil.parsedate(date) | ||||
if opts.get('remove'): | if opts.get('remove'): | ||||
editform = 'tag.remove' | editform = 'tag.remove' | ||||
else: | else: | ||||
editform = 'tag.add' | editform = 'tag.add' | ||||
editor = cmdutil.getcommiteditor(editform=editform, | editor = cmdutil.getcommiteditor(editform=editform, | ||||
**pycompat.strkwargs(opts)) | **pycompat.strkwargs(opts)) | ||||
# don't allow tagging the null rev | # don't allow tagging the null rev | ||||
if (not opts.get('remove') and | if (not opts.get('remove') and | ||||
scmutil.revsingle(repo, rev_).rev() == nullrev): | scmutil.revsingle(repo, rev_).rev() == nullrev): | ||||
raise error.Abort(_("cannot tag null revision")) | raise error.Abort(_("cannot tag null revision")) | ||||
tagsmod.tag(repo, names, r, message, opts.get('local'), | tagsmod.tag(repo, names, node, message, opts.get('local'), | ||||
opts.get('user'), date, editor=editor) | opts.get('user'), date, editor=editor) | ||||
finally: | finally: | ||||
release(lock, wlock) | release(lock, wlock) | ||||
@command('tags', formatteropts, '', cmdtype=readonly) | @command('tags', formatteropts, '', cmdtype=readonly) | ||||
def tags(ui, repo, **opts): | def tags(ui, repo, **opts): | ||||
"""list repository tags | """list repository tags | ||||