Show More
@@ -901,6 +901,7 def bisect(ui, repo, rev=None, extra=Non | |||||
901 | ('d', 'delete', False, _('delete a given bookmark')), |
|
901 | ('d', 'delete', False, _('delete a given bookmark')), | |
902 | ('m', 'rename', '', _('rename a given bookmark'), _('OLD')), |
|
902 | ('m', 'rename', '', _('rename a given bookmark'), _('OLD')), | |
903 | ('i', 'inactive', False, _('mark a bookmark inactive')), |
|
903 | ('i', 'inactive', False, _('mark a bookmark inactive')), | |
|
904 | ('', 'active', False, _('display the active bookmark')), | |||
904 | ] + formatteropts, |
|
905 | ] + formatteropts, | |
905 | _('hg bookmarks [OPTIONS]... [NAME]...')) |
|
906 | _('hg bookmarks [OPTIONS]... [NAME]...')) | |
906 | def bookmark(ui, repo, *names, **opts): |
|
907 | def bookmark(ui, repo, *names, **opts): | |
@@ -927,6 +928,10 def bookmark(ui, repo, *names, **opts): | |||||
927 | A bookmark named '@' has the special property that :hg:`clone` will |
|
928 | A bookmark named '@' has the special property that :hg:`clone` will | |
928 | check it out by default if it exists. |
|
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 | .. container:: verbose |
|
935 | .. container:: verbose | |
931 |
|
936 | |||
932 | Examples: |
|
937 | Examples: | |
@@ -956,6 +961,7 def bookmark(ui, repo, *names, **opts): | |||||
956 | delete = opts.get(r'delete') |
|
961 | delete = opts.get(r'delete') | |
957 | rename = opts.get(r'rename') |
|
962 | rename = opts.get(r'rename') | |
958 | inactive = opts.get(r'inactive') |
|
963 | inactive = opts.get(r'inactive') | |
|
964 | active = opts.get(r'active') | |||
959 |
|
965 | |||
960 | if delete and rename: |
|
966 | if delete and rename: | |
961 | raise error.Abort(_("--delete and --rename are incompatible")) |
|
967 | raise error.Abort(_("--delete and --rename are incompatible")) | |
@@ -963,6 +969,16 def bookmark(ui, repo, *names, **opts): | |||||
963 | raise error.Abort(_("--rev is incompatible with --delete")) |
|
969 | raise error.Abort(_("--rev is incompatible with --delete")) | |
964 | if rename and rev: |
|
970 | if rename and rev: | |
965 | raise error.Abort(_("--rev is incompatible with --rename")) |
|
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 | if not names and (delete or rev): |
|
982 | if not names and (delete or rev): | |
967 | raise error.Abort(_("bookmark name required")) |
|
983 | raise error.Abort(_("bookmark name required")) | |
968 |
|
984 | |||
@@ -987,6 +1003,11 def bookmark(ui, repo, *names, **opts): | |||||
987 | ui.status(_("no active bookmark\n")) |
|
1003 | ui.status(_("no active bookmark\n")) | |
988 | else: |
|
1004 | else: | |
989 | bookmarks.deactivate(repo) |
|
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 | else: # show bookmarks |
|
1011 | else: # show bookmarks | |
991 | bookmarks.printbookmarks(ui, repo, **opts) |
|
1012 | bookmarks.printbookmarks(ui, repo, **opts) | |
992 |
|
1013 |
@@ -222,3 +222,26 test that updating to closed branch head | |||||
222 | Z 0:719295282060 |
|
222 | Z 0:719295282060 | |
223 | $ hg parents -q |
|
223 | $ hg parents -q | |
224 | 4:8fa964221e8e |
|
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 Show all commands + options | |||||
249 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
249 | archive: no-decode, prefix, rev, type, subrepos, include, exclude | |
250 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
250 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
251 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
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 | branch: force, clean, rev |
|
253 | branch: force, clean, rev | |
254 | branches: active, closed, template |
|
254 | branches: active, closed, template | |
255 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
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