diff mercurial/bookmarks.py @ 18851:a60963c02f92

pull: list bookmarks before pulling changesets (issue3873) Consider a bookmark B that exists both locally and remotely. If B is updated remotely, and then a pull is performed where the pull set contains the new location of B, the bookmark is updated locally. However, if remote B is updated in the middle of a pull to a location not in the pull set, the bookmark won't be updated locally at all. To fix this, list bookmarks before pulling in changesets, not after. This still leaves a race open if B gets moved in between listing bookmarks and pulling in changesets, but the race window is much smaller. Fixing the race properly would require a bundle format upgrade. test-hook.t's output changes because we no longer do two listkeys calls during pull, just one. test-pull-http.t's output changes because we now search for bookmarks before searching for changes.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 29 Mar 2013 19:54:06 -0700
parents b4ddc43ddf9d
children efef056b1ae9
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Fri Mar 29 19:52:02 2013 -0700
+++ b/mercurial/bookmarks.py	Fri Mar 29 19:54:06 2013 -0700
@@ -221,9 +221,8 @@
     finally:
         w.release()
 
-def updatefromremote(ui, repo, remote, path):
+def updatefromremote(ui, repo, remotemarks, path):
     ui.debug("checking for updated bookmarks\n")
-    remotemarks = remote.listkeys('bookmarks')
     changed = False
     localmarks = repo._bookmarks
     for k in sorted(remotemarks):