Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 25446:b5311068077e
pull: prevent race condition in bookmark update when using -B (issue4689)
We are already fetching remote bookmarks to honor the -B option, we
now pass that data to the pull process so it can reuse it. This
prevents a race condition between the initial looking and the actual
pulling of changesets and bookmarks. Tests are updated to handle this
fact.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 01 Jun 2015 22:34:01 -0700 |
parents | 1457c1f28c92 |
children | 72edd54de935 |
comparison
equal
deleted
inserted
replaced
25445:1457c1f28c92 | 25446:b5311068077e |
---|---|
5127 # The list of bookmark used here is not the one used to actually | 5127 # The list of bookmark used here is not the one used to actually |
5128 # update the bookmark name. This can result in the revision pulled | 5128 # update the bookmark name. This can result in the revision pulled |
5129 # not ending up with the name of the bookmark because of a race | 5129 # not ending up with the name of the bookmark because of a race |
5130 # condition on the server. (See issue 4689 for details) | 5130 # condition on the server. (See issue 4689 for details) |
5131 remotebookmarks = other.listkeys('bookmarks') | 5131 remotebookmarks = other.listkeys('bookmarks') |
5132 pullopargs['remotebookmarks'] = remotebookmarks | |
5132 for b in opts['bookmark']: | 5133 for b in opts['bookmark']: |
5133 if b not in remotebookmarks: | 5134 if b not in remotebookmarks: |
5134 raise util.Abort(_('remote bookmark %s not found!') % b) | 5135 raise util.Abort(_('remote bookmark %s not found!') % b) |
5135 revs.append(remotebookmarks[b]) | 5136 revs.append(remotebookmarks[b]) |
5136 | 5137 |