Patchwork [09,of,10,py3] localrepo: turn hook kwargs back into strs before calling hook

login
register
mail settings
Submitter Augie Fackler
Date March 19, 2017, 6:26 p.m.
Message ID <ce928383cf5dfb0993d2.1489947982@imladris.local>
Download mbox | patch
Permalink /patch/19457/
State Accepted
Headers show

Comments

Augie Fackler - March 19, 2017, 6:26 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489900202 14400
#      Sun Mar 19 01:10:02 2017 -0400
# Node ID ce928383cf5dfb0993d27340b3fcf936a129e0fb
# Parent  9e6b585465b7ec033160326a4eb049329a2f83a9
localrepo: turn hook kwargs back into strs before calling hook

It might be better to ensure that the hook kwargs dict only has str
keys on Python 3. I'm torn.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1101,7 +1101,7 @@  class localrepository(object):
         def validate(tr):
             """will run pre-closing hooks"""
             reporef().hook('pretxnclose', throw=True,
-                           txnname=desc, **tr.hookargs)
+                           txnname=desc, **pycompat.strkwargs(tr.hookargs))
         def releasefn(tr, success):
             repo = reporef()
             if success:
@@ -1142,7 +1142,7 @@  class localrepository(object):
 
             def hook():
                 reporef().hook('txnclose', throw=False, txnname=desc,
-                               **hookargs)
+                               **pycompat.strkwargs(hookargs))
             reporef()._afterlock(hook)
         tr.addfinalize('txnclose-hook', txnclosehook)
         def txnaborthook(tr2):