diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -17,6 +17,7 @@ from .node import ( ) from . import ( encoding, + error, lock as lockmod, obsolete, util, @@ -154,7 +155,10 @@ class bmstore(dict): 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): diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t +++ b/tests/test-bookmarks-pushpull.t @@ -113,6 +113,19 @@ export the active bookmark 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