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