changeset 19515:14c91b18d798 stable

bookmarks: update only proper bookmarks on push -r/-B (issue 3973) Make push -r/-B update only these bookmarks that point to pushed revisions or their ancestors, so we can be sure that commit pointed by bookmark is present in the remote reposiory. Previously push tried to update all shared bookmarks.
author Wojciech Lopata <lopek@fb.com>
date Fri, 26 Jul 2013 13:34:51 -0700
parents cfdae231ba78
children fe78eb7bcca0
files mercurial/localrepo.py tests/test-bookmarks-pushpull.t
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Jul 28 15:02:32 2013 -0500
+++ b/mercurial/localrepo.py	Fri Jul 26 13:34:51 2013 -0700
@@ -1951,6 +1951,9 @@
 
         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])
@@ -1958,6 +1961,8 @@
                     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)
--- a/tests/test-bookmarks-pushpull.t	Sun Jul 28 15:02:32 2013 -0500
+++ b/tests/test-bookmarks-pushpull.t	Fri Jul 26 13:34:51 2013 -0700
@@ -422,7 +422,6 @@
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
-  updating bookmark @ failed!
   exporting bookmark add-foo
 
   $ cd ..