diff --git a/remotenames.py b/remotenames.py index 8352df72ca..95af240414 100644 --- a/remotenames.py +++ b/remotenames.py @@ -873,6 +873,11 @@ def exbookmarks(orig, ui, repo, *args, **opts): untrack = opts.get('untrack') disallowed = set(ui.configlist('remotenames', 'disallowedbookmarks')) + # Adds local bookmark if one of the options is called and args is empty + if not args and (track or untrack): + book = bookmarks.readactive(repo) + if book: + args = (book,) if not delete: for name in args: diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t new file mode 100644 index 0000000000..3f570a136b --- /dev/null +++ b/tests/test-bookmarks.t @@ -0,0 +1,29 @@ + $ extpath=`dirname $TESTDIR` + $ cp $extpath/remotenames.py $TESTTMP # use $TESTTMP substitution in message + $ cat >> $HGRCPATH << EOF + > [extensions] + > remotenames=$TESTTMP/remotenames.py + > EOF + +Setup repo + + $ hg init repo + $ cd repo + $ echo 'foo' > a.txt + $ hg add a.txt + $ hg commit -m 'a' + +Testing bookmark options without args + $ hg bookmark a + $ hg bookmark b + $ hg bookmark -v + a 0:2dcb9139ea49 + * b 0:2dcb9139ea49 + $ hg bookmark --track a + $ hg bookmark -v + a 0:2dcb9139ea49 + * b 0:2dcb9139ea49 [a] + $ hg bookmark --untrack + $ hg bookmark -v + a 0:2dcb9139ea49 + * b 0:2dcb9139ea49