D7512: exchange: guard against method invocation on `b2caps=None` args

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Nov 25 12:54:07 EST 2019


mharbison72 added a comment.


  In D7512#110528 <https://phab.mercurial-scm.org/D7512#110528>, @yuja wrote:
  
  >>   """add a changegroup part to the requested bundle"""
  >>
  >> - if not kwargs.get('cg', True):
  >>
  >> +    if not kwargs.get('cg', True) or not b2caps:
  >>
  >>   return
  >
  > Is it valid to call these functions with `b2caps=None`? I suspect it would
  > be a bug or a data corruption.
  
  The only caller I can find[1] will indeed pass something, even if it is `{}`.  I can change these to asserts if you want.
  
  [1] https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/exchange.py#l2448

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7512/new/

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

To: mharbison72, #hg-reviewers, dlax, indygreg
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list