reviewboard: handle kwargs more robustly (
bug 1235213); r?dminor
Mercurial 3.6 changed the "extra" keyword argument from an empty
tuple to None. It's quite possible the mutability of that default
argument was leading to our previous code not erroring.
Setting the argument to an empty dict in all false-y cases makes the
issue go away.
--- a/hgext/reviewboard/client.py
+++ b/hgext/reviewboard/client.py
@@ -1048,19 +1048,21 @@ def reposetup(ui, repo):
"""
# Some callers of commit() may not pass named arguments. Slurp
# extra from positional arguments.
if len(args) == 7:
assert 'extra' not in kwargs
kwargs['extra'] = args[6]
args = tuple(args[0:6])
- extra = kwargs.setdefault('extra', {})
- if 'commitid' not in extra and self.reviews.remoteurl:
- extra['commitid'] = genid(self)
+ if not kwargs['extra']:
+ kwargs['extra'] = {}
+
+ if 'commitid' not in kwargs['extra'] and self.reviews.remoteurl:
+ kwargs['extra']['commitid'] = genid(self)
return super(reviewboardrepo, self).commit(*args, **kwargs)
repo.__class__ = reviewboardrepo
repo.noreviewboardpush = False
repo.reviewid = None
def prepushoutgoinghook(local, remote, outgoing):