comparison hgext/bookmarks.py @ 11373:306fef8440af

bookmarks: pull known bookmarks from server that are newer
author Matt Mackall <mpm@selenic.com>
date Thu, 17 Jun 2010 12:10:47 -0500
parents 735f2d561747
children e291c039d8ec
comparison
equal deleted inserted replaced
11372:735f2d561747 11373:306fef8440af
282 self._bookmarksupdate(parents, node) 282 self._bookmarksupdate(parents, node)
283 return node 283 return node
284 finally: 284 finally:
285 wlock.release() 285 wlock.release()
286 286
287 def pull(self, remote, heads=None, force=False):
288 result = super(bookmark_repo, self).pull(remote, heads, force)
289
290 self.ui.debug("checking for updated bookmarks\n")
291 rb = remote.listkeys('bookmarks')
292 changes = 0
293 for k in rb.keys():
294 if k in self._bookmarks:
295 nr, nl = rb[k], self._bookmarks[k]
296 if nr in self:
297 cr = self[nr]
298 cl = self[nl]
299 if cl.rev() >= cr.rev():
300 continue
301 if cr in cl.descendants():
302 self._bookmarks[k] = cr.node()
303 changes += 1
304 self.ui.status(_("updating bookmark %s\n") % k)
305 else:
306 self.ui.warn(_("not updating divergent"
307 " bookmark %s\n") % k)
308 if changes:
309 write(repo)
310
311 return result
312
287 def addchangegroup(self, source, srctype, url, emptyok=False): 313 def addchangegroup(self, source, srctype, url, emptyok=False):
288 parents = self.dirstate.parents() 314 parents = self.dirstate.parents()
289 315
290 result = super(bookmark_repo, self).addchangegroup( 316 result = super(bookmark_repo, self).addchangegroup(
291 source, srctype, url, emptyok) 317 source, srctype, url, emptyok)