mercurial/commands.py
changeset 5658 ae3089cefaab
parent 5657 47915bf68c44
child 5660 3c80ecdc1bcd
equal deleted inserted replaced
5657:47915bf68c44 5658:ae3089cefaab
  2456 def tags(ui, repo):
  2456 def tags(ui, repo):
  2457     """list repository tags
  2457     """list repository tags
  2458 
  2458 
  2459     List the repository tags.
  2459     List the repository tags.
  2460 
  2460 
  2461     This lists both regular and local tags.
  2461     This lists both regular and local tags. When the -v/--verbose switch
       
  2462     is used, a third column "local" is printed for local tags.
  2462     """
  2463     """
  2463 
  2464 
  2464     l = repo.tagslist()
  2465     l = repo.tagslist()
  2465     l.reverse()
  2466     l.reverse()
  2466     hexfunc = ui.debugflag and hex or short
  2467     hexfunc = ui.debugflag and hex or short
       
  2468     tagtype = ""
       
  2469 
  2467     for t, n in l:
  2470     for t, n in l:
       
  2471         if ui.quiet:
       
  2472             ui.write("%s\n" % t)
       
  2473             continue
       
  2474 
  2468         try:
  2475         try:
  2469             hn = hexfunc(n)
  2476             hn = hexfunc(n)
  2470             r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n))
  2477             r = "%5d:%s" % (repo.changelog.rev(n), hn)
  2471         except revlog.LookupError:
  2478         except revlog.LookupError:
  2472             r = "    ?:%s" % hn
  2479             r = "    ?:%s" % hn
  2473         if ui.quiet:
       
  2474             ui.write("%s\n" % t)
       
  2475         else:
  2480         else:
  2476             spaces = " " * (30 - util.locallen(t))
  2481             spaces = " " * (30 - util.locallen(t))
  2477             ui.write("%s%s %s\n" % (t, spaces, r))
  2482             if ui.verbose:
       
  2483                 if repo.tagtype(t) == 'local':
       
  2484                     tagtype = " local"
       
  2485                 else:
       
  2486                     tagtype = ""
       
  2487             ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
  2478 
  2488 
  2479 def tip(ui, repo, **opts):
  2489 def tip(ui, repo, **opts):
  2480     """show the tip revision
  2490     """show the tip revision
  2481 
  2491 
  2482     Show the tip revision.
  2492     Show the tip revision.