# HG changeset patch # User liscju # Date 2016-06-13 21:50:26 # Node ID af849596752cc9663146160518a3125d50077f09 # Parent a9ccd9af48efccfa5b5b348cf095c5af241c6780 bookmarks: abort 'push -B .' when no active bookmark 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