# HG changeset patch # User Siddharth Agarwal # Date 1384890450 28800 # Node ID 1053f5a7bbc617ce91cc4b577a2dfc5f3658b731 # Parent b349e476a622bbb4709d211ae48353244cc23861 commands.bookmarks: separate out 'no bookmarks set' status messages Upcoming patches will acquire the wlock for write operations, such as make inactive, but not read-only ones, such as list bookmarks. Separate out the status messages so that the code paths can be separated. diff -r b349e476a622 -r 1053f5a7bbc6 mercurial/commands.py --- a/mercurial/commands.py Sat Nov 16 19:56:53 2013 -0500 +++ b/mercurial/commands.py Tue Nov 19 11:47:30 2013 -0800 @@ -906,31 +906,31 @@ bookmarks.unsetcurrent(repo) marks.write() - # Same message whether trying to deactivate the current bookmark (-i - # with no NAME) or listing bookmarks - elif len(marks) == 0: - ui.status(_("no bookmarks set\n")) - elif inactive: - if not repo._bookmarkcurrent: + if len(marks) == 0: + ui.status(_("no bookmarks set\n")) + elif not repo._bookmarkcurrent: ui.status(_("no active bookmark\n")) else: bookmarks.unsetcurrent(repo) else: # show bookmarks - for bmark, n in sorted(marks.iteritems()): - current = repo._bookmarkcurrent - if bmark == current: - prefix, label = '*', 'bookmarks.current' - else: - prefix, label = ' ', '' - - if ui.quiet: - ui.write("%s\n" % bmark, label=label) - else: - ui.write(" %s %-25s %d:%s\n" % ( - prefix, bmark, repo.changelog.rev(n), hexfn(n)), - label=label) + if len(marks) == 0: + ui.status(_("no bookmarks set\n")) + else: + for bmark, n in sorted(marks.iteritems()): + current = repo._bookmarkcurrent + if bmark == current: + prefix, label = '*', 'bookmarks.current' + else: + prefix, label = ' ', '' + + if ui.quiet: + ui.write("%s\n" % bmark, label=label) + else: + ui.write(" %s %-25s %d:%s\n" % ( + prefix, bmark, repo.changelog.rev(n), hexfn(n)), + label=label) @command('branch', [('f', 'force', None,