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