bookmarks: make setcurrent with None an error
authorSiddharth Agarwal <sid0@fb.com>
Fri, 15 Nov 2013 18:41:40 -0800
changeset 20100 0f01d0692bc5
parent 20099 6284b0b16033
child 20101 80d8bd69b5db
bookmarks: make setcurrent with None an error
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Fri Nov 15 18:31:02 2013 -0800
+++ b/mercurial/bookmarks.py	Fri Nov 15 18:41:40 2013 -0800
@@ -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)