comparison tests/test-fncache.t @ 23510:065c0334846f

fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize' Now that we have a shiny generic mechanism, we can use it.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 04 Dec 2014 13:49:45 -0800
parents cd86a6707159
children 0ff6b65afeb0
comparison
equal deleted inserted replaced
23509:32e68271a037 23510:065c0334846f
208 208
209 Aborting transaction prevents fncache change 209 Aborting transaction prevents fncache change
210 210
211 $ cat > ../exceptionext.py <<EOF 211 $ cat > ../exceptionext.py <<EOF
212 > import os 212 > import os
213 > from mercurial import commands, util, transaction 213 > from mercurial import commands, util, localrepo
214 > from mercurial.extensions import wrapfunction 214 > from mercurial.extensions import wrapfunction
215 > 215 >
216 > def wrapper(orig, self, *args, **kwargs): 216 > def wrapper(orig, self, *args, **kwargs):
217 > origonclose = self.onclose 217 > tr = orig(self, *args, **kwargs)
218 > def onclose(): 218 > def fail(tr):
219 > origonclose()
220 > raise util.Abort("forced transaction failure") 219 > raise util.Abort("forced transaction failure")
221 > self.onclose = onclose 220 > # zzz prefix to ensure it sorted after store.write
222 > return orig(self, *args, **kwargs) 221 > tr.addfinalize('zzz-forcefails', fail)
222 > return tr
223 > 223 >
224 > def uisetup(ui): 224 > def uisetup(ui):
225 > wrapfunction(transaction.transaction, 'close', wrapper) 225 > wrapfunction(localrepo.localrepository, 'transaction', wrapper)
226 > 226 >
227 > cmdtable = {} 227 > cmdtable = {}
228 > 228 >
229 > EOF 229 > EOF
230 $ rm -f "${extpath}c" 230 $ rm -f "${extpath}c"