Show More
@@ -4414,49 +4414,47 b' def pull(ui, repo, source="default", **o' | |||
|
4414 | 4414 | revs, checkout = hg.addbranchrevs(repo, other, branches, |
|
4415 | 4415 | opts.get('rev')) |
|
4416 | 4416 | |
|
4417 | ||
|
4418 | 4417 | pullopargs = {} |
|
4419 | if opts.get('bookmark'): | |
|
4420 | if not revs: | |
|
4421 | revs = [] | |
|
4422 |
# The list of bookmark used here is |
|
|
4423 | # update the bookmark name. This can result in the revision pulled | |
|
4424 | # not ending up with the name of the bookmark because of a race | |
|
4425 |
# |
|
|
4426 | remotebookmarks = other.listkeys('bookmarks') | |
|
4418 | ||
|
4419 | nodes = None | |
|
4420 | if opts['bookmark'] or revs: | |
|
4421 | # The list of bookmark used here is the same used to actually update | |
|
4422 | # the bookmark names, to avoid the race from issue 4689 and we do | |
|
4423 | # all lookup and bookmark queries in one go so they see the same | |
|
4424 | # version of the server state (issue 4700). | |
|
4425 | nodes = [] | |
|
4426 | fnodes = [] | |
|
4427 | revs = revs or [] | |
|
4428 | if revs and not other.capable('lookup'): | |
|
4429 | err = _("other repository doesn't support revision lookup, " | |
|
4430 | "so a rev cannot be specified.") | |
|
4431 | raise error.Abort(err) | |
|
4432 | with other.commandexecutor() as e: | |
|
4433 | fremotebookmarks = e.callcommand('listkeys', { | |
|
4434 | 'namespace': 'bookmarks' | |
|
4435 | }) | |
|
4436 | for r in revs: | |
|
4437 | fnodes.append(e.callcommand('lookup', {'key': r})) | |
|
4438 | remotebookmarks = fremotebookmarks.result() | |
|
4427 | 4439 | remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks) |
|
4428 | 4440 | pullopargs['remotebookmarks'] = remotebookmarks |
|
4429 | 4441 | for b in opts['bookmark']: |
|
4430 | 4442 | b = repo._bookmarks.expandname(b) |
|
4431 | 4443 | if b not in remotebookmarks: |
|
4432 | 4444 | raise error.Abort(_('remote bookmark %s not found!') % b) |
|
4433 |
|
|
|
4434 | ||
|
4435 | if revs: | |
|
4436 | try: | |
|
4437 | # When 'rev' is a bookmark name, we cannot guarantee that it | |
|
4438 | # will be updated with that name because of a race condition | |
|
4439 | # server side. (See issue 4689 for details) | |
|
4440 | oldrevs = revs | |
|
4441 | revs = [] # actually, nodes | |
|
4442 | for r in oldrevs: | |
|
4443 | with other.commandexecutor() as e: | |
|
4444 | node = e.callcommand('lookup', {'key': r}).result() | |
|
4445 | ||
|
4446 | revs.append(node) | |
|
4447 | if r == checkout: | |
|
4445 | nodes.append(remotebookmarks[b]) | |
|
4446 | for i, rev in enumerate(revs): | |
|
4447 | node = fnodes[i].result() | |
|
4448 | nodes.append(node) | |
|
4449 | if rev == checkout: | |
|
4448 | 4450 | checkout = node |
|
4449 | except error.CapabilityError: | |
|
4450 | err = _("other repository doesn't support revision lookup, " | |
|
4451 | "so a rev cannot be specified.") | |
|
4452 | raise error.Abort(err) | |
|
4453 | 4451 | |
|
4454 | 4452 | wlock = util.nullcontextmanager() |
|
4455 | 4453 | if opts.get('update'): |
|
4456 | 4454 | wlock = repo.wlock() |
|
4457 | 4455 | with wlock: |
|
4458 | 4456 | pullopargs.update(opts.get('opargs', {})) |
|
4459 |
modheads = exchange.pull(repo, other, heads= |
|
|
4457 | modheads = exchange.pull(repo, other, heads=nodes, | |
|
4460 | 4458 | force=opts.get('force'), |
|
4461 | 4459 | bookmarks=opts.get('bookmark', ()), |
|
4462 | 4460 | opargs=pullopargs).cgresult |
@@ -673,12 +673,13 b' Update a bookmark right after the initia' | |||
|
673 | 673 | adding manifests |
|
674 | 674 | adding file changes |
|
675 | 675 | added 1 changesets with 1 changes to 1 files |
|
676 | updating bookmark Y | |
|
676 | 677 | new changesets 0d60821d2197 (1 drafts) |
|
677 | 678 | (run 'hg update' to get a working copy) |
|
678 | 679 | $ hg book |
|
679 | 680 | @ 1:0d2164f0ce0d |
|
680 | 681 | X 1:0d2164f0ce0d |
|
681 |
* Y |
|
|
682 | * Y 6:0d60821d2197 | |
|
682 | 683 | Z 1:0d2164f0ce0d |
|
683 | 684 | $ hg -R $TESTTMP/pull-race book |
|
684 | 685 | @ 1:0d2164f0ce0d |
General Comments 0
You need to be logged in to leave comments.
Login now