Mercurial > hg
changeset 29354:af849596752c
bookmarks: abort 'push -B .' when no active bookmark
author | liscju <piotr.listkiewicz@gmail.com> |
---|---|
date | Mon, 13 Jun 2016 23:50:26 +0200 |
parents | a9ccd9af48ef |
children | 85868ecf2c0d |
files | mercurial/bookmarks.py tests/test-bookmarks-pushpull.t |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Mon Jun 13 05:11:56 2016 +0900 +++ b/mercurial/bookmarks.py Mon Jun 13 23:50:26 2016 +0200 @@ -17,6 +17,7 @@ ) from . import ( encoding, + error, lock as lockmod, obsolete, util, @@ -154,7 +155,10 @@ def expandname(self, bname): if bname == '.': - return self.active + if self.active: + return self.active + else: + raise error.Abort(_("no active bookmark")) return bname def _readactive(repo, marks):
--- a/tests/test-bookmarks-pushpull.t Mon Jun 13 05:11:56 2016 +0900 +++ b/tests/test-bookmarks-pushpull.t Mon Jun 13 23:50:26 2016 +0200 @@ -113,6 +113,19 @@ exporting bookmark V [1] +exporting the active bookmark with 'push -B .' +demand that one of the bookmarks is activated + + $ hg update -r default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (leaving bookmark V) + $ hg push -B . ../a + abort: no active bookmark + [255] + $ hg update -r V + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + (activating bookmark V) + delete the bookmark $ hg book -d V