Show More
@@ -904,7 +904,6 b' def bisect(ui, repo, rev=None, extra=Non' | |||||
904 | ('m', 'rename', '', _('rename a given bookmark'), _('OLD')), |
|
904 | ('m', 'rename', '', _('rename a given bookmark'), _('OLD')), | |
905 | ('i', 'inactive', False, _('mark a bookmark inactive')), |
|
905 | ('i', 'inactive', False, _('mark a bookmark inactive')), | |
906 | ('l', 'list', False, _('list existing bookmarks')), |
|
906 | ('l', 'list', False, _('list existing bookmarks')), | |
907 | ('', 'active', False, _('display the active bookmark')), |
|
|||
908 | ] + formatteropts, |
|
907 | ] + formatteropts, | |
909 | _('hg bookmarks [OPTIONS]... [NAME]...')) |
|
908 | _('hg bookmarks [OPTIONS]... [NAME]...')) | |
910 | def bookmark(ui, repo, *names, **opts): |
|
909 | def bookmark(ui, repo, *names, **opts): | |
@@ -931,10 +930,6 b' def bookmark(ui, repo, *names, **opts):' | |||||
931 | A bookmark named '@' has the special property that :hg:`clone` will |
|
930 | A bookmark named '@' has the special property that :hg:`clone` will | |
932 | check it out by default if it exists. |
|
931 | check it out by default if it exists. | |
933 |
|
932 | |||
934 | The '--active' flag will display the current bookmark or return non-zero, |
|
|||
935 | if combined with other action, they will be performed on the active |
|
|||
936 | bookmark. |
|
|||
937 |
|
||||
938 | .. container:: verbose |
|
933 | .. container:: verbose | |
939 |
|
934 | |||
940 | Examples: |
|
935 | Examples: | |
@@ -958,14 +953,17 b' def bookmark(ui, repo, *names, **opts):' | |||||
958 | - move the '@' bookmark from another branch:: |
|
953 | - move the '@' bookmark from another branch:: | |
959 |
|
954 | |||
960 | hg book -f @ |
|
955 | hg book -f @ | |
|
956 | ||||
|
957 | - print only the active bookmark name:: | |||
|
958 | ||||
|
959 | hg book -ql . | |||
961 | ''' |
|
960 | ''' | |
962 | opts = pycompat.byteskwargs(opts) |
|
961 | opts = pycompat.byteskwargs(opts) | |
963 | force = opts.get('force') |
|
962 | force = opts.get('force') | |
964 | rev = opts.get('rev') |
|
963 | rev = opts.get('rev') | |
965 | inactive = opts.get('inactive') # meaning add/rename to inactive bookmark |
|
964 | inactive = opts.get('inactive') # meaning add/rename to inactive bookmark | |
966 |
|
965 | |||
967 |
selactions = [k for k in ['delete', 'rename', ' |
|
966 | selactions = [k for k in ['delete', 'rename', 'list'] if opts.get(k)] | |
968 | if opts.get(k)] |
|
|||
969 | if len(selactions) > 1: |
|
967 | if len(selactions) > 1: | |
970 | raise error.Abort(_('--%s and --%s are incompatible') |
|
968 | raise error.Abort(_('--%s and --%s are incompatible') | |
971 | % tuple(selactions[:2])) |
|
969 | % tuple(selactions[:2])) | |
@@ -978,11 +976,9 b' def bookmark(ui, repo, *names, **opts):' | |||||
978 | else: |
|
976 | else: | |
979 | action = 'list' |
|
977 | action = 'list' | |
980 |
|
978 | |||
981 |
if rev and action in {'delete', 'rename', ' |
|
979 | if rev and action in {'delete', 'rename', 'list'}: | |
982 | raise error.Abort(_("--rev is incompatible with --%s") % action) |
|
980 | raise error.Abort(_("--rev is incompatible with --%s") % action) | |
983 |
if |
|
981 | if inactive and action in {'delete', 'list'}: | |
984 | raise error.Abort(_("NAMES is incompatible with --active")) |
|
|||
985 | if inactive and action in {'delete', 'active', 'list'}: |
|
|||
986 | raise error.Abort(_("--inactive is incompatible with --%s") % action) |
|
982 | raise error.Abort(_("--inactive is incompatible with --%s") % action) | |
987 | if not names and action in {'add', 'delete'}: |
|
983 | if not names and action in {'add', 'delete'}: | |
988 | raise error.Abort(_("bookmark name required")) |
|
984 | raise error.Abort(_("bookmark name required")) | |
@@ -1008,11 +1004,6 b' def bookmark(ui, repo, *names, **opts):' | |||||
1008 | ui.status(_("no active bookmark\n")) |
|
1004 | ui.status(_("no active bookmark\n")) | |
1009 | else: |
|
1005 | else: | |
1010 | bookmarks.deactivate(repo) |
|
1006 | bookmarks.deactivate(repo) | |
1011 | elif action == 'active': |
|
|||
1012 | book = repo._activebookmark |
|
|||
1013 | if book is None: |
|
|||
1014 | return 1 |
|
|||
1015 | ui.write("%s\n" % book, label=bookmarks.activebookmarklabel) |
|
|||
1016 | elif action == 'list': |
|
1007 | elif action == 'list': | |
1017 | names = pycompat.maplist(repo._bookmarks.expandname, names) |
|
1008 | names = pycompat.maplist(repo._bookmarks.expandname, names) | |
1018 | with ui.formatter('bookmarks', opts) as fm: |
|
1009 | with ui.formatter('bookmarks', opts) as fm: |
@@ -240,8 +240,9 b' display how "{activebookmark}" template ' | |||||
240 | - Y |
|
240 | - Y | |
241 | - |
|
241 | - | |
242 |
|
242 | |||
243 |
$ hg bookmarks - |
|
243 | $ hg bookmarks -ql . | |
244 | Y |
|
244 | Y | |
245 | $ hg bookmarks --inactive |
|
245 | $ hg bookmarks --inactive | |
246 |
$ hg bookmarks - |
|
246 | $ hg bookmarks -ql . | |
247 | [1] |
|
247 | abort: no active bookmark! | |
|
248 | [255] |
@@ -250,7 +250,7 b' Show all commands + options' | |||||
250 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
250 | archive: no-decode, prefix, rev, type, subrepos, include, exclude | |
251 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
251 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
252 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
252 | bisect: reset, good, bad, skip, extend, command, noupdate | |
253 |
bookmarks: force, rev, delete, rename, inactive, list, |
|
253 | bookmarks: force, rev, delete, rename, inactive, list, template | |
254 | branch: force, clean, rev |
|
254 | branch: force, clean, rev | |
255 | branches: active, closed, template |
|
255 | branches: active, closed, template | |
256 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
256 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
General Comments 0
You need to be logged in to leave comments.
Login now