[PATCH 1 of 5 V3] commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal
sid0 at fb.com
Fri Dec 20 16:04:01 UTC 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1384890450 28800
# Tue Nov 19 11:47:30 2013 -0800
# Node ID cc4fbea8fd8863d0e92868fccd9217c3152ae3e5
# Parent 77393672ef93c70213cf61be650a23883ec94045
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 77393672ef93c70213cf61be650a23883ec94045 -r cc4fbea8fd8863d0e92868fccd9217c3152ae3e5 mercurial/commands.py
--- a/mercurial/commands.py Sun Nov 17 16:32:23 2013 -0800
+++ b/mercurial/commands.py Tue Nov 19 11:47:30 2013 -0800
@@ -906,31 +906,31 @@ def bookmark(ui, repo, *names, **opts):
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,
More information about the Mercurial-devel
mailing list