pull: use opts.get('bookmark') instead of opts['bookmark']
authorPulkit Goyal <pulkit@yandex-team.ru>
Wed, 26 Dec 2018 17:36:53 +0300
changeset 41121 5967995c32bb
parent 41120 79f8f032c706
child 41122 14271b524d76
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
mercurial/commands.py
--- a/mercurial/commands.py	Fri Jan 04 20:27:17 2019 +0530
+++ b/mercurial/commands.py	Wed Dec 26 17:36:53 2018 +0300
@@ -4427,7 +4427,7 @@
         pullopargs = {}
 
         nodes = None
-        if opts['bookmark'] or revs:
+        if opts.get('bookmark') or revs:
             # The list of bookmark used here is the same used to actually update
             # the bookmark names, to avoid the race from issue 4689 and we do
             # all lookup and bookmark queries in one go so they see the same
@@ -4448,7 +4448,7 @@
             remotebookmarks = fremotebookmarks.result()
             remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks)
             pullopargs['remotebookmarks'] = remotebookmarks
-            for b in opts['bookmark']:
+            for b in opts.get('bookmark', []):
                 b = repo._bookmarks.expandname(b)
                 if b not in remotebookmarks:
                     raise error.Abort(_('remote bookmark %s not found!') % b)