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.
--- 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,