[PATCH 1 of 2] bookmarks: abort 'push -B .' when no active bookmark
liscju
piotr.listkiewicz at gmail.com
Mon Jun 13 21:58:01 UTC 2016
# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1465854626 -7200
# Mon Jun 13 23:50:26 2016 +0200
# Node ID 89551c7ce02f153967898ab94fd3190334b6e49a
# Parent 48b38b16a8f83ea98ebdf0b370f59fd90dc17935
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,
@@ -152,7 +153,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
More information about the Mercurial-devel
mailing list