changeset 11374:e291c039d8ec

bookmarks: update known bookmarks on the target on push
author Matt Mackall <mpm@selenic.com>
date Thu, 17 Jun 2010 12:22:21 -0500
parents 306fef8440af
children 0f33abfccaa1
files hgext/bookmarks.py
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Thu Jun 17 12:10:47 2010 -0500
+++ b/hgext/bookmarks.py	Thu Jun 17 12:22:21 2010 -0500
@@ -310,6 +310,28 @@
 
             return result
 
+        def push(self, remote, force=False, revs=None, newbranch=False):
+            result = super(bookmark_repo, self).push(remote, force, revs,
+                                                     newbranch)
+
+            self.ui.debug("checking for updated bookmarks\n")
+            rb = remote.listkeys('bookmarks')
+            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 in cr.descendants():
+                            r = remote.pushkey('bookmarks', k, nr, nl)
+                            if r:
+                                self.ui.status(_("updating bookmark %s\n") % k)
+                            else:
+                                self.ui.warn(_("failed to update bookmark"
+                                                  " %s!\n") % k)
+
+            return result
+
         def addchangegroup(self, source, srctype, url, emptyok=False):
             parents = self.dirstate.parents()