Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 31509:5c9936193145
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.
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 19 Mar 2017 01:10:02 -0400 |
parents | 590319c07259 |
children | 2244fb3eee49 |
comparison
equal
deleted
inserted
replaced
31508:590319c07259 | 31509:5c9936193145 |
---|---|
1099 # we must avoid cyclic reference between repo and transaction. | 1099 # we must avoid cyclic reference between repo and transaction. |
1100 reporef = weakref.ref(self) | 1100 reporef = weakref.ref(self) |
1101 def validate(tr): | 1101 def validate(tr): |
1102 """will run pre-closing hooks""" | 1102 """will run pre-closing hooks""" |
1103 reporef().hook('pretxnclose', throw=True, | 1103 reporef().hook('pretxnclose', throw=True, |
1104 txnname=desc, **tr.hookargs) | 1104 txnname=desc, **pycompat.strkwargs(tr.hookargs)) |
1105 def releasefn(tr, success): | 1105 def releasefn(tr, success): |
1106 repo = reporef() | 1106 repo = reporef() |
1107 if success: | 1107 if success: |
1108 # this should be explicitly invoked here, because | 1108 # this should be explicitly invoked here, because |
1109 # in-memory changes aren't written out at closing | 1109 # in-memory changes aren't written out at closing |
1140 # fixes the function accumulation. | 1140 # fixes the function accumulation. |
1141 hookargs = tr2.hookargs | 1141 hookargs = tr2.hookargs |
1142 | 1142 |
1143 def hook(): | 1143 def hook(): |
1144 reporef().hook('txnclose', throw=False, txnname=desc, | 1144 reporef().hook('txnclose', throw=False, txnname=desc, |
1145 **hookargs) | 1145 **pycompat.strkwargs(hookargs)) |
1146 reporef()._afterlock(hook) | 1146 reporef()._afterlock(hook) |
1147 tr.addfinalize('txnclose-hook', txnclosehook) | 1147 tr.addfinalize('txnclose-hook', txnclosehook) |
1148 def txnaborthook(tr2): | 1148 def txnaborthook(tr2): |
1149 """To be run if transaction is aborted | 1149 """To be run if transaction is aborted |
1150 """ | 1150 """ |