diff tests/test-bookmarks-current.t @ 39276:337443f09fc8

bookmark: add an --active flag to display the active bookmark There is currently no official simple way to retrieve the current bookmark. In particular for automation. We add a `--active` flag to the `hg bookmarks` command. When set, the command display the current bookmark name if any or return 1. For now, this flag is read-only. However sensible combinations exist with `--delete`, `--rename` and `--rev` and can be implemented later.
author Boris Feld <boris.feld@octobus.net>
date Thu, 16 Aug 2018 17:19:27 +0200
parents 2e1bceeea520
children c48738923dba
line wrap: on
line diff
--- a/tests/test-bookmarks-current.t	Thu Aug 23 01:48:39 2018 +0200
+++ b/tests/test-bookmarks-current.t	Thu Aug 16 17:19:27 2018 +0200
@@ -222,3 +222,26 @@
      Z                         0:719295282060
   $ hg parents -q
   4:8fa964221e8e
+
+Checks command to retrieve active bookmark
+------------------------------------------
+
+display how "{activebookmark}" template is unsuitable for the task
+
+  $ hg book -T '- {activebookmark}\n'
+  - 
+  - Y
+  - 
+
+  $ hg book -r . W
+  $ hg book -T '- {activebookmark}\n'
+  - Y
+  - 
+  - Y
+  - 
+
+  $ hg bookmarks --active
+  Y
+  $ hg bookmarks --inactive
+  $ hg bookmarks --active
+  [1]