[PATCH 4 of 4] bookmarks: make setcurrent with None an error

Siddharth Agarwal sid0 at fb.com
Fri Nov 15 21:18:14 CST 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1384569700 28800
#      Fri Nov 15 18:41:40 2013 -0800
# Node ID 2325d676e14d9c0383fdc888e73cf869473f6132
# Parent  da43a40374316cb92dc3d50aeb2eff02ba3325ad
bookmarks: make setcurrent with None an error

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -106,13 +106,13 @@
     Set the name of the bookmark that we are on (hg update <bookmark>).
     The name is recorded in .hg/bookmarks.current
     '''
+    if mark not in repo._bookmarks:
+        raise AssertionError('bookmark %s does not exist!' % mark)
+
     current = repo._bookmarkcurrent
     if current == mark:
         return
 
-    if mark not in repo._bookmarks:
-        mark = ''
-
     wlock = repo.wlock()
     try:
         file = repo.opener('bookmarks.current', 'w', atomictemp=True)


More information about the Mercurial-devel mailing list