##// END OF EJS Templates
bookmarks: write() can simply access repo._bookmarks
Nicolas Dumazet -
r10106:cb3f6da9 default
parent child Browse files
Show More
@@ -51,7 +51,7 b' def parse(repo):'
51 pass
51 pass
52 return bookmarks
52 return bookmarks
53
53
54 def write(repo, refs):
54 def write(repo):
55 '''Write bookmarks
55 '''Write bookmarks
56
56
57 Write the given bookmark => hash dictionary to the .hg/bookmarks file
57 Write the given bookmark => hash dictionary to the .hg/bookmarks file
@@ -60,6 +60,7 b' def write(repo, refs):'
60 We also store a backup of the previous state in undo.bookmarks that
60 We also store a backup of the previous state in undo.bookmarks that
61 can be copied back on rollback.
61 can be copied back on rollback.
62 '''
62 '''
63 refs = repo._bookmarks
63 if os.path.exists(repo.join('bookmarks')):
64 if os.path.exists(repo.join('bookmarks')):
64 util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
65 util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
65 if current(repo) not in refs:
66 if current(repo) not in refs:
@@ -147,7 +148,7 b' def bookmark(ui, repo, mark=None, rev=No'
147 del marks[rename]
148 del marks[rename]
148 if current(repo) == rename:
149 if current(repo) == rename:
149 setcurrent(repo, mark)
150 setcurrent(repo, mark)
150 write(repo, marks)
151 write(repo)
151 return
152 return
152
153
153 if delete:
154 if delete:
@@ -158,7 +159,7 b' def bookmark(ui, repo, mark=None, rev=No'
158 if mark == current(repo):
159 if mark == current(repo):
159 setcurrent(repo, None)
160 setcurrent(repo, None)
160 del marks[mark]
161 del marks[mark]
161 write(repo, marks)
162 write(repo)
162 return
163 return
163
164
164 if mark != None:
165 if mark != None:
@@ -176,7 +177,7 b' def bookmark(ui, repo, mark=None, rev=No'
176 else:
177 else:
177 marks[mark] = repo.changectx('.').node()
178 marks[mark] = repo.changectx('.').node()
178 setcurrent(repo, mark)
179 setcurrent(repo, mark)
179 write(repo, marks)
180 write(repo)
180 return
181 return
181
182
182 if mark is None:
183 if mark is None:
@@ -226,7 +227,7 b' def strip(oldstrip, ui, repo, node, back'
226 if len(update) > 0:
227 if len(update) > 0:
227 for m in update:
228 for m in update:
228 marks[m] = repo.changectx('.').node()
229 marks[m] = repo.changectx('.').node()
229 write(repo, marks)
230 write(repo)
230
231
231 def reposetup(ui, repo):
232 def reposetup(ui, repo):
232 if not repo.local():
233 if not repo.local():
@@ -276,7 +277,7 b' def reposetup(ui, repo):'
276 marks[mark] = node
277 marks[mark] = node
277 update = True
278 update = True
278 if update:
279 if update:
279 write(self, marks)
280 write(self)
280 return node
281 return node
281 finally:
282 finally:
282 wlock.release()
283 wlock.release()
@@ -303,7 +304,7 b' def reposetup(ui, repo):'
303 marks[mark] = node
304 marks[mark] = node
304 update = True
305 update = True
305 if update:
306 if update:
306 write(self, marks)
307 write(self)
307 return result
308 return result
308
309
309 def _findtags(self):
310 def _findtags(self):
General Comments 0
You need to be logged in to leave comments. Login now