tests/test-largefiles-small-disk.t
branchstable
changeset 15571 809788118aa2
child 15572 926bc23d0b6a
equal deleted inserted replaced
15570:0f208626d503 15571:809788118aa2
       
     1 Test how largefiles abort in case the disk runs full
       
     2 
       
     3   $ cat > criple.py <<EOF
       
     4   > import os, errno, shutil
       
     5   > from mercurial import util
       
     6   > #
       
     7   > # this makes the original largefiles code abort:
       
     8   > def copyfileobj(fsrc, fdst, length=16*1024):
       
     9   >     fdst.write(fsrc.read(4))
       
    10   >     raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC))
       
    11   > shutil.copyfileobj = copyfileobj
       
    12   > #
       
    13   > # this makes the rewritten code abort:
       
    14   > def filechunkiter(f, size=65536, limit=None):
       
    15   >     yield f.read(4)
       
    16   >     raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC))
       
    17   > util.filechunkiter = filechunkiter
       
    18   > EOF
       
    19 
       
    20   $ echo "[extensions]" >> $HGRCPATH
       
    21   $ echo "largefiles =" >> $HGRCPATH
       
    22 
       
    23   $ hg init alice
       
    24   $ cd alice
       
    25   $ echo "this is a very big file" > big
       
    26   $ hg add --large big
       
    27   $ hg commit --config extensions.criple=$TESTTMP/criple.py -m big
       
    28   abort: No space left on device
       
    29   [255]
       
    30 
       
    31 The largefile is not created in .hg/largefiles:
       
    32 
       
    33   $ ls .hg/largefiles
       
    34   dirstate
       
    35 
       
    36 The user cache is not even created:
       
    37 
       
    38   >>> import os; os.path.exists("$HOME/.cache/largefiles/")
       
    39   False