[PATCH 2 of 3] pull: document the race condition with bookmark name

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri May 29 17:25:14 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1432846913 25200
#      Thu May 28 14:01:53 2015 -0700
# Node ID f9a958f8bc37c17ff8b10eee45ee51379ab90124
# Parent  8b25f0ff5c7236148eddbf4b17b37e583d495865
pull: document the race condition with bookmark name

It seems valuable to point this in-situ to help the next poor soul looking at
this code to understand what kind of beast he is currently facing.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5121,18 +5121,25 @@ def pull(ui, repo, source="default", **o
 
 
         if opts.get('bookmark'):
             if not revs:
                 revs = []
+            # The list of bookmark used here is not the one used to actually
+            # update the bookmark name. This can result in the revision pulled
+            # to not end up with the name of the bookmark because of race
+            # condition on the server. (See issue 4689 for details)
             remotebookmarks = other.listkeys('bookmarks')
             for b in opts['bookmark']:
                 if b not in remotebookmarks:
                     raise util.Abort(_('remote bookmark %s not found!') % b)
                 revs.append(remotebookmarks[b])
 
         if revs:
             try:
+                # When 'rev' is a bookmark name, we cannot garantee that it
+                # will be updated with such name because of a race condition
+                # server side. (See issue 4689 for details)
                 revs = [other.lookup(rev) for rev in revs]
             except error.CapabilityError:
                 err = _("other repository doesn't support revision lookup, "
                         "so a rev cannot be specified.")
                 raise util.Abort(err)


More information about the Mercurial-devel mailing list