D7512: exchange: guard against method invocation on `b2caps=None` args
Yuya Nishihara
yuya at tcha.org
Tue Nov 26 08:04:22 EST 2019
> >> """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
Well, I have no expertise around this module, so I have no idea which is
better. I just don't know if it's valid to return successfully if b2caps
is None.
More information about the Mercurial-devel
mailing list