tests/test-fncache.t
branchstable
changeset 21160 564f55b25122
parent 20883 cd443c7589cc
child 21760 a7f5967ff644
equal deleted inserted replaced
21028:a0f437e2f5a9 21160:564f55b25122
   175   .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
   175   .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
   176   .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
   176   .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
   177 
   177 
   178   $ cd ..
   178   $ cd ..
   179 
   179 
   180 
   180 Aborting lock does not prevent fncache writes
       
   181 
       
   182   $ cat > exceptionext.py <<EOF
       
   183   > import os
       
   184   > from mercurial import commands, util
       
   185   > from mercurial.extensions import wrapfunction
       
   186   > 
       
   187   > def lockexception(orig, vfs, lockname, wait, releasefn, acquirefn, desc):
       
   188   >     def releasewrap():
       
   189   >         raise util.Abort("forced lock failure")
       
   190   >     return orig(vfs, lockname, wait, releasewrap, acquirefn, desc)
       
   191   > 
       
   192   > def reposetup(ui, repo):
       
   193   >     wrapfunction(repo, '_lock', lockexception)
       
   194   > 
       
   195   > cmdtable = {}
       
   196   > 
       
   197   > EOF
       
   198   $ extpath=`pwd`/exceptionext.py
       
   199   $ hg init fncachetxn
       
   200   $ cd fncachetxn
       
   201   $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
       
   202   $ touch y
       
   203   $ hg ci -qAm y
       
   204   abort: forced lock failure
       
   205   [255]
       
   206   $ cat .hg/store/fncache
       
   207   data/y.i
       
   208 
       
   209 Aborting transaction prevents fncache change
       
   210 
       
   211   $ cat > ../exceptionext.py <<EOF
       
   212   > import os
       
   213   > from mercurial import commands, util, transaction
       
   214   > from mercurial.extensions import wrapfunction
       
   215   > 
       
   216   > def wrapper(orig, self, *args, **kwargs):
       
   217   >     origonclose = self.onclose
       
   218   >     def onclose():
       
   219   >         origonclose()
       
   220   >         raise util.Abort("forced transaction failure")
       
   221   >     self.onclose = onclose
       
   222   >     return orig(self, *args, **kwargs)
       
   223   > 
       
   224   > def uisetup(ui):
       
   225   >     wrapfunction(transaction.transaction, 'close', wrapper)
       
   226   > 
       
   227   > cmdtable = {}
       
   228   > 
       
   229   > EOF
       
   230   $ rm "${extpath}c"
       
   231   $ touch z
       
   232   $ hg ci -qAm z
       
   233   transaction abort!
       
   234   rollback completed
       
   235   abort: forced transaction failure
       
   236   [255]
       
   237   $ cat .hg/store/fncache
       
   238   data/y.i