bookmark: allowing to use -t -u with no arg if a bookmark is activated

allowing to use -t -u with no arg if a bookmark is activated
This commit is contained in:
Cecile Berillon 2015-10-06 11:48:22 -07:00
parent 2a4e20d541
commit 582dde2e81
2 changed files with 34 additions and 0 deletions

View File

@ -873,6 +873,11 @@ def exbookmarks(orig, ui, repo, *args, **opts):
untrack = opts.get('untrack') untrack = opts.get('untrack')
disallowed = set(ui.configlist('remotenames', 'disallowedbookmarks')) 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: if not delete:
for name in args: for name in args:

29
tests/test-bookmarks.t Normal file
View File

@ -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