5747 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) |
5747 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) |
5748 finally: |
5748 finally: |
5749 release(lock, wlock) |
5749 release(lock, wlock) |
5750 |
5750 |
5751 @command('tags', [], '') |
5751 @command('tags', [], '') |
5752 def tags(ui, repo): |
5752 def tags(ui, repo, **opts): |
5753 """list repository tags |
5753 """list repository tags |
5754 |
5754 |
5755 This lists both regular and local tags. When the -v/--verbose |
5755 This lists both regular and local tags. When the -v/--verbose |
5756 switch is used, a third column "local" is printed for local tags. |
5756 switch is used, a third column "local" is printed for local tags. |
5757 |
5757 |
5758 Returns 0 on success. |
5758 Returns 0 on success. |
5759 """ |
5759 """ |
5760 |
5760 |
|
5761 fm = ui.formatter('tags', opts) |
5761 hexfunc = ui.debugflag and hex or short |
5762 hexfunc = ui.debugflag and hex or short |
5762 tagtype = "" |
5763 tagtype = "" |
5763 |
5764 |
5764 for t, n in reversed(repo.tagslist()): |
5765 for t, n in reversed(repo.tagslist()): |
5765 if ui.quiet: |
|
5766 ui.write("%s\n" % t, label='tags.normal') |
|
5767 continue |
|
5768 |
|
5769 hn = hexfunc(n) |
5766 hn = hexfunc(n) |
5770 r = "%5d:%s" % (repo.changelog.rev(n), hn) |
5767 label = 'tags.normal' |
5771 rev = ui.label(r, 'log.changeset changeset.%s' % repo[n].phasestr()) |
5768 tagtype = '' |
5772 spaces = " " * (30 - encoding.colwidth(t)) |
5769 if repo.tagtype(t) == 'local': |
5773 |
5770 label = 'tags.local' |
5774 tag = ui.label(t, 'tags.normal') |
5771 tagtype = 'local' |
5775 if ui.verbose: |
5772 |
5776 if repo.tagtype(t) == 'local': |
5773 fm.startitem() |
5777 tagtype = " local" |
5774 fm.write('tag', '%s', t, label=label) |
5778 tag = ui.label(t, 'tags.local') |
5775 fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' |
5779 else: |
5776 fm.condwrite(not ui.quiet, 'rev id', fmt, |
5780 tagtype = "" |
5777 repo.changelog.rev(n), hn, label=label) |
5781 ui.write("%s%s %s%s\n" % (tag, spaces, rev, tagtype)) |
5778 fm.condwrite(ui.verbose and tagtype, 'type', ' %s', |
|
5779 tagtype, label=label) |
|
5780 fm.plain('\n') |
|
5781 fm.end() |
5782 |
5782 |
5783 @command('tip', |
5783 @command('tip', |
5784 [('p', 'patch', None, _('show patch')), |
5784 [('p', 'patch', None, _('show patch')), |
5785 ('g', 'git', None, _('use git extended diff format')), |
5785 ('g', 'git', None, _('use git extended diff format')), |
5786 ] + templateopts, |
5786 ] + templateopts, |