Patchwork D11619: hg: use dict.get() instead, to prevent KeyError

login
register
mail settings
Submitter phabricator
Date Oct. 8, 2021, 11:34 a.m.
Message ID <differential-rev-PHID-DREV-cstmn2fm5ffgxjazxwog-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49943/
State Superseded
Headers show

Comments

phabricator - Oct. 8, 2021, 11:34 a.m.
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11619

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/hg.py

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1285,7 +1285,7 @@ 
         if revs:
             revs = [other.lookup(rev) for rev in revs]
         other, chlist, cleanupfn = bundlerepo.getremotechanges(
-            ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
+            ui, repo, other, revs, opts.get(b"bundle"), opts.get(b"force")
         )
 
         if not chlist:
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3905,7 +3905,12 @@ 
         with ui.silent():
             try:
                 other, chlist, cleanupfn = bundlerepo.getremotechanges(
-                    ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
+                    ui,
+                    repo,
+                    other,
+                    revs,
+                    opts.get(b"bundle"),
+                    opts.get(b"force"),
                 )
             except error.LookupError:
                 continue