mercurial/commands.py
changeset 20231 1053f5a7bbc6
parent 20227 9c963a43ecfb
child 20232 5fe4c1a9dc34
equal deleted inserted replaced
20230:b349e476a622 20231:1053f5a7bbc6
   904             bookmarks.setcurrent(repo, newact)
   904             bookmarks.setcurrent(repo, newact)
   905         elif cur != tgt and newact == repo._bookmarkcurrent:
   905         elif cur != tgt and newact == repo._bookmarkcurrent:
   906             bookmarks.unsetcurrent(repo)
   906             bookmarks.unsetcurrent(repo)
   907         marks.write()
   907         marks.write()
   908 
   908 
   909     # Same message whether trying to deactivate the current bookmark (-i
       
   910     # with no NAME) or listing bookmarks
       
   911     elif len(marks) == 0:
       
   912         ui.status(_("no bookmarks set\n"))
       
   913 
       
   914     elif inactive:
   909     elif inactive:
   915         if not repo._bookmarkcurrent:
   910         if len(marks) == 0:
       
   911             ui.status(_("no bookmarks set\n"))
       
   912         elif not repo._bookmarkcurrent:
   916             ui.status(_("no active bookmark\n"))
   913             ui.status(_("no active bookmark\n"))
   917         else:
   914         else:
   918             bookmarks.unsetcurrent(repo)
   915             bookmarks.unsetcurrent(repo)
   919 
   916 
   920     else: # show bookmarks
   917     else: # show bookmarks
   921         for bmark, n in sorted(marks.iteritems()):
   918         if len(marks) == 0:
   922             current = repo._bookmarkcurrent
   919             ui.status(_("no bookmarks set\n"))
   923             if bmark == current:
   920         else:
   924                 prefix, label = '*', 'bookmarks.current'
   921             for bmark, n in sorted(marks.iteritems()):
   925             else:
   922                 current = repo._bookmarkcurrent
   926                 prefix, label = ' ', ''
   923                 if bmark == current:
   927 
   924                     prefix, label = '*', 'bookmarks.current'
   928             if ui.quiet:
   925                 else:
   929                 ui.write("%s\n" % bmark, label=label)
   926                     prefix, label = ' ', ''
   930             else:
   927 
   931                 ui.write(" %s %-25s %d:%s\n" % (
   928                 if ui.quiet:
   932                     prefix, bmark, repo.changelog.rev(n), hexfn(n)),
   929                     ui.write("%s\n" % bmark, label=label)
   933                     label=label)
   930                 else:
       
   931                     ui.write(" %s %-25s %d:%s\n" % (
       
   932                         prefix, bmark, repo.changelog.rev(n), hexfn(n)),
       
   933                         label=label)
   934 
   934 
   935 @command('branch',
   935 @command('branch',
   936     [('f', 'force', None,
   936     [('f', 'force', None,
   937      _('set branch name even if it shadows an existing branch')),
   937      _('set branch name even if it shadows an existing branch')),
   938     ('C', 'clean', None, _('reset branch name to parent branch name'))],
   938     ('C', 'clean', None, _('reset branch name to parent branch name'))],