diff mercurial/localrepo.py @ 20027:4b06b2a445a1

bookmarks: rewrite pushing bookmarks in "localrepository.push()" by "compare()" This patch adds "updateremote()", which uses "compare()" to compare bookmarks between the local and the remote repositories, to replace pushing local bookmarks in "localrepository.push()".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 08 Nov 2013 12:45:52 +0900
parents d1ac3790e10a
children f962870712da
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Nov 08 12:45:52 2013 +0900
+++ b/mercurial/localrepo.py	Fri Nov 08 12:45:52 2013 +0900
@@ -1976,27 +1976,7 @@
             if locallock is not None:
                 locallock.release()
 
-        self.ui.debug("checking for updated bookmarks\n")
-        rb = remote.listkeys('bookmarks')
-        revnums = map(unfi.changelog.rev, revs or [])
-        ancestors = [
-            a for a in unfi.changelog.ancestors(revnums, inclusive=True)]
-        for k in rb.keys():
-            if k in unfi._bookmarks:
-                nr, nl = rb[k], hex(self._bookmarks[k])
-                if nr in unfi:
-                    cr = unfi[nr]
-                    cl = unfi[nl]
-                    if bookmarks.validdest(unfi, cr, cl):
-                        if ancestors and cl.rev() not in ancestors:
-                            continue
-                        r = remote.pushkey('bookmarks', k, nr, nl)
-                        if r:
-                            self.ui.status(_("updating bookmark %s\n") % k)
-                        else:
-                            self.ui.warn(_('updating bookmark %s'
-                                           ' failed!\n') % k)
-
+        bookmarks.updateremote(self.ui, unfi, remote, revs)
         return ret
 
     def changegroupinfo(self, nodes, source):