Show More
@@ -969,6 +969,8 b' def bookmark(ui, repo, *names, **opts):' | |||||
969 | % tuple(selactions[:2])) |
|
969 | % tuple(selactions[:2])) | |
970 | if selactions: |
|
970 | if selactions: | |
971 | action = selactions[0] |
|
971 | action = selactions[0] | |
|
972 | elif names or rev: | |||
|
973 | action = 'add' | |||
972 | else: |
|
974 | else: | |
973 | action = None |
|
975 | action = None | |
974 |
|
976 | |||
@@ -978,10 +980,10 b' def bookmark(ui, repo, *names, **opts):' | |||||
978 | raise error.Abort(_("NAMES is incompatible with --active")) |
|
980 | raise error.Abort(_("NAMES is incompatible with --active")) | |
979 | if inactive and action == 'active': |
|
981 | if inactive and action == 'active': | |
980 | raise error.Abort(_("--inactive is incompatible with --active")) |
|
982 | raise error.Abort(_("--inactive is incompatible with --active")) | |
981 |
if not names and |
|
983 | if not names and action in {'add', 'delete'}: | |
982 | raise error.Abort(_("bookmark name required")) |
|
984 | raise error.Abort(_("bookmark name required")) | |
983 |
|
985 | |||
984 |
if action in {'delete', 'rename'} or |
|
986 | if action in {'add', 'delete', 'rename'} or inactive: | |
985 | with repo.wlock(), repo.lock(), repo.transaction('bookmark') as tr: |
|
987 | with repo.wlock(), repo.lock(), repo.transaction('bookmark') as tr: | |
986 | if action == 'delete': |
|
988 | if action == 'delete': | |
987 | names = pycompat.maplist(repo._bookmarks.expandname, names) |
|
989 | names = pycompat.maplist(repo._bookmarks.expandname, names) | |
@@ -993,7 +995,7 b' def bookmark(ui, repo, *names, **opts):' | |||||
993 | raise error.Abort(_("only one new bookmark name allowed")) |
|
995 | raise error.Abort(_("only one new bookmark name allowed")) | |
994 | oldname = repo._bookmarks.expandname(opts['rename']) |
|
996 | oldname = repo._bookmarks.expandname(opts['rename']) | |
995 | bookmarks.rename(repo, tr, oldname, names[0], force, inactive) |
|
997 | bookmarks.rename(repo, tr, oldname, names[0], force, inactive) | |
996 |
elif |
|
998 | elif action == 'add': | |
997 | bookmarks.addbookmarks(repo, tr, names, rev, force, inactive) |
|
999 | bookmarks.addbookmarks(repo, tr, names, rev, force, inactive) | |
998 | elif inactive: |
|
1000 | elif inactive: | |
999 | if len(repo._bookmarks) == 0: |
|
1001 | if len(repo._bookmarks) == 0: |
General Comments 0
You need to be logged in to leave comments.
Login now