Show More
@@ -961,7 +961,7 def bookmark(ui, repo, *names, **opts): | |||||
961 | opts = pycompat.byteskwargs(opts) |
|
961 | opts = pycompat.byteskwargs(opts) | |
962 | force = opts.get('force') |
|
962 | force = opts.get('force') | |
963 | rev = opts.get('rev') |
|
963 | rev = opts.get('rev') | |
964 | inactive = opts.get('inactive') |
|
964 | inactive = opts.get('inactive') # meaning add/rename to inactive bookmark | |
965 |
|
965 | |||
966 | selactions = [k for k in ['delete', 'rename', 'active'] if opts.get(k)] |
|
966 | selactions = [k for k in ['delete', 'rename', 'active'] if opts.get(k)] | |
967 | if len(selactions) > 1: |
|
967 | if len(selactions) > 1: | |
@@ -971,6 +971,8 def bookmark(ui, repo, *names, **opts): | |||||
971 | action = selactions[0] |
|
971 | action = selactions[0] | |
972 | elif names or rev: |
|
972 | elif names or rev: | |
973 | action = 'add' |
|
973 | action = 'add' | |
|
974 | elif inactive: | |||
|
975 | action = 'inactive' # meaning deactivate | |||
974 | else: |
|
976 | else: | |
975 | action = None |
|
977 | action = None | |
976 |
|
978 | |||
@@ -983,7 +985,7 def bookmark(ui, repo, *names, **opts): | |||||
983 | if not names and action in {'add', 'delete'}: |
|
985 | if not names and action in {'add', 'delete'}: | |
984 | raise error.Abort(_("bookmark name required")) |
|
986 | raise error.Abort(_("bookmark name required")) | |
985 |
|
987 | |||
986 |
if action in {'add', 'delete', 'rename'} |
|
988 | if action in {'add', 'delete', 'rename', 'inactive'}: | |
987 | with repo.wlock(), repo.lock(), repo.transaction('bookmark') as tr: |
|
989 | with repo.wlock(), repo.lock(), repo.transaction('bookmark') as tr: | |
988 | if action == 'delete': |
|
990 | if action == 'delete': | |
989 | names = pycompat.maplist(repo._bookmarks.expandname, names) |
|
991 | names = pycompat.maplist(repo._bookmarks.expandname, names) | |
@@ -997,7 +999,7 def bookmark(ui, repo, *names, **opts): | |||||
997 | bookmarks.rename(repo, tr, oldname, names[0], force, inactive) |
|
999 | bookmarks.rename(repo, tr, oldname, names[0], force, inactive) | |
998 | elif action == 'add': |
|
1000 | elif action == 'add': | |
999 | bookmarks.addbookmarks(repo, tr, names, rev, force, inactive) |
|
1001 | bookmarks.addbookmarks(repo, tr, names, rev, force, inactive) | |
1000 | elif inactive: |
|
1002 | elif action == 'inactive': | |
1001 | if len(repo._bookmarks) == 0: |
|
1003 | if len(repo._bookmarks) == 0: | |
1002 | ui.status(_("no bookmarks set\n")) |
|
1004 | ui.status(_("no bookmarks set\n")) | |
1003 | elif not repo._activebookmark: |
|
1005 | elif not repo._activebookmark: |
General Comments 0
You need to be logged in to leave comments.
Login now