comparison mercurial/bookmarks.py @ 20100:0f01d0692bc5

bookmarks: make setcurrent with None an error
author Siddharth Agarwal <sid0@fb.com>
date Fri, 15 Nov 2013 18:41:40 -0800
parents 2880b45636ca
children 67ee87a371b2
comparison
equal deleted inserted replaced
20099:6284b0b16033 20100:0f01d0692bc5
104 '''Set the name of the bookmark that we are currently on 104 '''Set the name of the bookmark that we are currently on
105 105
106 Set the name of the bookmark that we are on (hg update <bookmark>). 106 Set the name of the bookmark that we are on (hg update <bookmark>).
107 The name is recorded in .hg/bookmarks.current 107 The name is recorded in .hg/bookmarks.current
108 ''' 108 '''
109 if mark not in repo._bookmarks:
110 raise AssertionError('bookmark %s does not exist!' % mark)
111
109 current = repo._bookmarkcurrent 112 current = repo._bookmarkcurrent
110 if current == mark: 113 if current == mark:
111 return 114 return
112
113 if mark not in repo._bookmarks:
114 mark = ''
115 115
116 wlock = repo.wlock() 116 wlock = repo.wlock()
117 try: 117 try:
118 file = repo.opener('bookmarks.current', 'w', atomictemp=True) 118 file = repo.opener('bookmarks.current', 'w', atomictemp=True)
119 file.write(encoding.fromlocal(mark)) 119 file.write(encoding.fromlocal(mark))