# HG changeset patch # User Osku Salerma # Date 2007-12-09 08:14:38 # Node ID ae3089cefaab41c90d0fa96681c67e5be7f71a1d # Parent 47915bf68c446fe7cbee49ad4dbc516c5575fcf3 Add --verbose support to tags command. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2458,23 +2458,33 @@ def tags(ui, repo): List the repository tags. - This lists both regular and local tags. + This lists both regular and local tags. When the -v/--verbose switch + is used, a third column "local" is printed for local tags. """ l = repo.tagslist() l.reverse() hexfunc = ui.debugflag and hex or short + tagtype = "" + for t, n in l: + if ui.quiet: + ui.write("%s\n" % t) + continue + try: hn = hexfunc(n) - r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n)) + r = "%5d:%s" % (repo.changelog.rev(n), hn) except revlog.LookupError: r = " ?:%s" % hn - if ui.quiet: - ui.write("%s\n" % t) else: spaces = " " * (30 - util.locallen(t)) - ui.write("%s%s %s\n" % (t, spaces, r)) + if ui.verbose: + if repo.tagtype(t) == 'local': + tagtype = " local" + else: + tagtype = "" + ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype)) def tip(ui, repo, **opts): """show the tip revision diff --git a/tests/test-tags b/tests/test-tags --- a/tests/test-tags +++ b/tests/test-tags @@ -142,4 +142,5 @@ hg tag --remove localtag hg tag -r 0 globaltag hg tag --remove -l globaltag +hg tags -v exit 0 diff --git a/tests/test-tags.out b/tests/test-tags.out --- a/tests/test-tags.out +++ b/tests/test-tags.out @@ -74,3 +74,6 @@ bar 2:72b adding foo abort: localtag tag is local abort: globaltag tag is global +tip 1:a0b6fe111088 +localtag 0:bbd179dfa0a7 local +globaltag 0:bbd179dfa0a7