Show More
@@ -252,44 +252,7 b' def reposetup(ui, repo):' | |||||
252 | key = self._bookmarks[key] |
|
252 | key = self._bookmarks[key] | |
253 | return super(bookmark_repo, self).lookup(key) |
|
253 | return super(bookmark_repo, self).lookup(key) | |
254 |
|
254 | |||
255 |
def |
|
255 | def _bookmarksupdate(self, parents, node): | |
256 | """Add a revision to the repository and |
|
|||
257 | move the bookmark""" |
|
|||
258 | wlock = self.wlock() # do both commit and bookmark with lock held |
|
|||
259 | try: |
|
|||
260 | node = super(bookmark_repo, self).commitctx(ctx, error) |
|
|||
261 | if node is None: |
|
|||
262 | return None |
|
|||
263 | parents = self.changelog.parents(node) |
|
|||
264 | if parents[1] == nullid: |
|
|||
265 | parents = (parents[0],) |
|
|||
266 | marks = self._bookmarks |
|
|||
267 | update = False |
|
|||
268 | if ui.configbool('bookmarks', 'track.current'): |
|
|||
269 | mark = self._bookmarkcurrent |
|
|||
270 | if mark and marks[mark] in parents: |
|
|||
271 | marks[mark] = node |
|
|||
272 | update = True |
|
|||
273 | else: |
|
|||
274 | for mark, n in marks.items(): |
|
|||
275 | if n in parents: |
|
|||
276 | marks[mark] = node |
|
|||
277 | update = True |
|
|||
278 | if update: |
|
|||
279 | write(self) |
|
|||
280 | return node |
|
|||
281 | finally: |
|
|||
282 | wlock.release() |
|
|||
283 |
|
||||
284 | def addchangegroup(self, source, srctype, url, emptyok=False): |
|
|||
285 | parents = self.dirstate.parents() |
|
|||
286 |
|
||||
287 | result = super(bookmark_repo, self).addchangegroup( |
|
|||
288 | source, srctype, url, emptyok) |
|
|||
289 | if result > 1: |
|
|||
290 | # We have more heads than before |
|
|||
291 | return result |
|
|||
292 | node = self.changelog.tip() |
|
|||
293 | marks = self._bookmarks |
|
256 | marks = self._bookmarks | |
294 | update = False |
|
257 | update = False | |
295 | if ui.configbool('bookmarks', 'track.current'): |
|
258 | if ui.configbool('bookmarks', 'track.current'): | |
@@ -304,6 +267,35 b' def reposetup(ui, repo):' | |||||
304 | update = True |
|
267 | update = True | |
305 | if update: |
|
268 | if update: | |
306 | write(self) |
|
269 | write(self) | |
|
270 | ||||
|
271 | def commitctx(self, ctx, error=False): | |||
|
272 | """Add a revision to the repository and | |||
|
273 | move the bookmark""" | |||
|
274 | wlock = self.wlock() # do both commit and bookmark with lock held | |||
|
275 | try: | |||
|
276 | node = super(bookmark_repo, self).commitctx(ctx, error) | |||
|
277 | if node is None: | |||
|
278 | return None | |||
|
279 | parents = self.changelog.parents(node) | |||
|
280 | if parents[1] == nullid: | |||
|
281 | parents = (parents[0],) | |||
|
282 | ||||
|
283 | self._bookmarksupdate(parents, node) | |||
|
284 | return node | |||
|
285 | finally: | |||
|
286 | wlock.release() | |||
|
287 | ||||
|
288 | def addchangegroup(self, source, srctype, url, emptyok=False): | |||
|
289 | parents = self.dirstate.parents() | |||
|
290 | ||||
|
291 | result = super(bookmark_repo, self).addchangegroup( | |||
|
292 | source, srctype, url, emptyok) | |||
|
293 | if result > 1: | |||
|
294 | # We have more heads than before | |||
|
295 | return result | |||
|
296 | node = self.changelog.tip() | |||
|
297 | ||||
|
298 | self._bookmarksupdate(parents, node) | |||
307 | return result |
|
299 | return result | |
308 |
|
300 | |||
309 | def _findtags(self): |
|
301 | def _findtags(self): |
General Comments 0
You need to be logged in to leave comments.
Login now