# HG changeset patch # User Matt Mackall # Date 1276794647 18000 # Node ID 306fef8440af0a07f48c6502c6681d880fa116e1 # Parent 735f2d561747948fc6b1187201618e18b90e7e60 bookmarks: pull known bookmarks from server that are newer diff -r 735f2d561747 -r 306fef8440af hgext/bookmarks.py --- a/hgext/bookmarks.py Thu Jun 17 11:01:51 2010 -0500 +++ b/hgext/bookmarks.py Thu Jun 17 12:10:47 2010 -0500 @@ -284,6 +284,32 @@ finally: wlock.release() + def pull(self, remote, heads=None, force=False): + result = super(bookmark_repo, self).pull(remote, heads, force) + + self.ui.debug("checking for updated bookmarks\n") + rb = remote.listkeys('bookmarks') + changes = 0 + for k in rb.keys(): + if k in self._bookmarks: + nr, nl = rb[k], self._bookmarks[k] + if nr in self: + cr = self[nr] + cl = self[nl] + if cl.rev() >= cr.rev(): + continue + if cr in cl.descendants(): + self._bookmarks[k] = cr.node() + changes += 1 + self.ui.status(_("updating bookmark %s\n") % k) + else: + self.ui.warn(_("not updating divergent" + " bookmark %s\n") % k) + if changes: + write(repo) + + return result + def addchangegroup(self, source, srctype, url, emptyok=False): parents = self.dirstate.parents()