Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 41121:5967995c32bb
pull: use opts.get('bookmark') instead of opts['bookmark']
This is done because at places in hgsubversion, we call the function directly. I
expect there might be more instances in extensions out there which calls
commands.push() directly. So let's not require explicitly passing of bookmark
value.
The use of opts['bookmark'] was introduced in
bad05a6afdc89cc58a2af320698ab29bd8de62d4.
Differential Revision: https://phab.mercurial-scm.org/D5484
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 26 Dec 2018 17:36:53 +0300 |
parents | 4506f801e492 |
children | 074c72a38423 |
comparison
equal
deleted
inserted
replaced
41120:79f8f032c706 | 41121:5967995c32bb |
---|---|
4425 opts.get('rev')) | 4425 opts.get('rev')) |
4426 | 4426 |
4427 pullopargs = {} | 4427 pullopargs = {} |
4428 | 4428 |
4429 nodes = None | 4429 nodes = None |
4430 if opts['bookmark'] or revs: | 4430 if opts.get('bookmark') or revs: |
4431 # The list of bookmark used here is the same used to actually update | 4431 # The list of bookmark used here is the same used to actually update |
4432 # the bookmark names, to avoid the race from issue 4689 and we do | 4432 # the bookmark names, to avoid the race from issue 4689 and we do |
4433 # all lookup and bookmark queries in one go so they see the same | 4433 # all lookup and bookmark queries in one go so they see the same |
4434 # version of the server state (issue 4700). | 4434 # version of the server state (issue 4700). |
4435 nodes = [] | 4435 nodes = [] |
4446 for r in revs: | 4446 for r in revs: |
4447 fnodes.append(e.callcommand('lookup', {'key': r})) | 4447 fnodes.append(e.callcommand('lookup', {'key': r})) |
4448 remotebookmarks = fremotebookmarks.result() | 4448 remotebookmarks = fremotebookmarks.result() |
4449 remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks) | 4449 remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks) |
4450 pullopargs['remotebookmarks'] = remotebookmarks | 4450 pullopargs['remotebookmarks'] = remotebookmarks |
4451 for b in opts['bookmark']: | 4451 for b in opts.get('bookmark', []): |
4452 b = repo._bookmarks.expandname(b) | 4452 b = repo._bookmarks.expandname(b) |
4453 if b not in remotebookmarks: | 4453 if b not in remotebookmarks: |
4454 raise error.Abort(_('remote bookmark %s not found!') % b) | 4454 raise error.Abort(_('remote bookmark %s not found!') % b) |
4455 nodes.append(remotebookmarks[b]) | 4455 nodes.append(remotebookmarks[b]) |
4456 for i, rev in enumerate(revs): | 4456 for i, rev in enumerate(revs): |