Show More
@@ -901,6 +901,7 b' def bisect(ui, repo, rev=None, extra=Non' | |||
|
901 | 901 | ('d', 'delete', False, _('delete a given bookmark')), |
|
902 | 902 | ('m', 'rename', '', _('rename a given bookmark'), _('OLD')), |
|
903 | 903 | ('i', 'inactive', False, _('mark a bookmark inactive')), |
|
904 | ('', 'active', False, _('display the active bookmark')), | |
|
904 | 905 | ] + formatteropts, |
|
905 | 906 | _('hg bookmarks [OPTIONS]... [NAME]...')) |
|
906 | 907 | def bookmark(ui, repo, *names, **opts): |
@@ -927,6 +928,10 b' def bookmark(ui, repo, *names, **opts):' | |||
|
927 | 928 | A bookmark named '@' has the special property that :hg:`clone` will |
|
928 | 929 | check it out by default if it exists. |
|
929 | 930 | |
|
931 | The '--active' flag will display the current bookmark or return non-zero, | |
|
932 | if combined with other action, they will be performed on the active | |
|
933 | bookmark. | |
|
934 | ||
|
930 | 935 | .. container:: verbose |
|
931 | 936 | |
|
932 | 937 | Examples: |
@@ -956,6 +961,7 b' def bookmark(ui, repo, *names, **opts):' | |||
|
956 | 961 | delete = opts.get(r'delete') |
|
957 | 962 | rename = opts.get(r'rename') |
|
958 | 963 | inactive = opts.get(r'inactive') |
|
964 | active = opts.get(r'active') | |
|
959 | 965 | |
|
960 | 966 | if delete and rename: |
|
961 | 967 | raise error.Abort(_("--delete and --rename are incompatible")) |
@@ -963,6 +969,16 b' def bookmark(ui, repo, *names, **opts):' | |||
|
963 | 969 | raise error.Abort(_("--rev is incompatible with --delete")) |
|
964 | 970 | if rename and rev: |
|
965 | 971 | raise error.Abort(_("--rev is incompatible with --rename")) |
|
972 | if delete and active: | |
|
973 | raise error.Abort(_("--delete is incompatible with --active")) | |
|
974 | if rev and active: | |
|
975 | raise error.Abort(_("--rev is incompatible with --active")) | |
|
976 | if rename and active: | |
|
977 | raise error.Abort(_("--rename is incompatible with --active")) | |
|
978 | if names and active: | |
|
979 | raise error.Abort(_("NAMES is incompatible with --active")) | |
|
980 | if inactive and active: | |
|
981 | raise error.Abort(_("--inactive is incompatible with --active")) | |
|
966 | 982 | if not names and (delete or rev): |
|
967 | 983 | raise error.Abort(_("bookmark name required")) |
|
968 | 984 | |
@@ -987,6 +1003,11 b' def bookmark(ui, repo, *names, **opts):' | |||
|
987 | 1003 | ui.status(_("no active bookmark\n")) |
|
988 | 1004 | else: |
|
989 | 1005 | bookmarks.deactivate(repo) |
|
1006 | elif active: | |
|
1007 | book = repo._activebookmark | |
|
1008 | if book is None: | |
|
1009 | return 1 | |
|
1010 | ui.write("%s\n" % book, label=bookmarks.activebookmarklabel) | |
|
990 | 1011 | else: # show bookmarks |
|
991 | 1012 | bookmarks.printbookmarks(ui, repo, **opts) |
|
992 | 1013 |
@@ -222,3 +222,26 b' test that updating to closed branch head' | |||
|
222 | 222 | Z 0:719295282060 |
|
223 | 223 | $ hg parents -q |
|
224 | 224 | 4:8fa964221e8e |
|
225 | ||
|
226 | Checks command to retrieve active bookmark | |
|
227 | ------------------------------------------ | |
|
228 | ||
|
229 | display how "{activebookmark}" template is unsuitable for the task | |
|
230 | ||
|
231 | $ hg book -T '- {activebookmark}\n' | |
|
232 | - | |
|
233 | - Y | |
|
234 | - | |
|
235 | ||
|
236 | $ hg book -r . W | |
|
237 | $ hg book -T '- {activebookmark}\n' | |
|
238 | - Y | |
|
239 | - | |
|
240 | - Y | |
|
241 | - | |
|
242 | ||
|
243 | $ hg bookmarks --active | |
|
244 | Y | |
|
245 | $ hg bookmarks --inactive | |
|
246 | $ hg bookmarks --active | |
|
247 | [1] |
@@ -249,7 +249,7 b' Show all commands + options' | |||
|
249 | 249 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
250 | 250 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
251 | 251 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
252 | bookmarks: force, rev, delete, rename, inactive, template | |
|
252 | bookmarks: force, rev, delete, rename, inactive, active, template | |
|
253 | 253 | branch: force, clean, rev |
|
254 | 254 | branches: active, closed, template |
|
255 | 255 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
General Comments 0
You need to be logged in to leave comments.
Login now