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