Show More
@@ -1,75 +1,75 b'' | |||
|
1 | 1 | Test how largefiles abort in case the disk runs full |
|
2 | 2 | |
|
3 | 3 | $ cat > criple.py <<EOF |
|
4 | 4 | > from __future__ import absolute_import |
|
5 | 5 | > import errno |
|
6 | 6 | > import os |
|
7 | 7 | > import shutil |
|
8 | 8 | > from mercurial import util |
|
9 | 9 | > # |
|
10 | 10 | > # this makes the original largefiles code abort: |
|
11 | 11 | > _origcopyfileobj = shutil.copyfileobj |
|
12 | 12 | > def copyfileobj(fsrc, fdst, length=16*1024): |
|
13 | 13 | > # allow journal files (used by transaction) to be written |
|
14 | > if 'journal.' in fdst.name: | |
|
14 | > if b'journal.' in fdst.name: | |
|
15 | 15 | > return _origcopyfileobj(fsrc, fdst, length) |
|
16 | 16 | > fdst.write(fsrc.read(4)) |
|
17 | 17 | > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) |
|
18 | 18 | > shutil.copyfileobj = copyfileobj |
|
19 | 19 | > # |
|
20 | 20 | > # this makes the rewritten code abort: |
|
21 | 21 | > def filechunkiter(f, size=131072, limit=None): |
|
22 | 22 | > yield f.read(4) |
|
23 | 23 | > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) |
|
24 | 24 | > util.filechunkiter = filechunkiter |
|
25 | 25 | > # |
|
26 | 26 | > def oslink(src, dest): |
|
27 | 27 | > raise OSError("no hardlinks, try copying instead") |
|
28 | 28 | > util.oslink = oslink |
|
29 | 29 | > EOF |
|
30 | 30 | |
|
31 | 31 | $ echo "[extensions]" >> $HGRCPATH |
|
32 | 32 | $ echo "largefiles =" >> $HGRCPATH |
|
33 | 33 | |
|
34 | 34 | $ hg init alice |
|
35 | 35 | $ cd alice |
|
36 | 36 | $ echo "this is a very big file" > big |
|
37 | 37 | $ hg add --large big |
|
38 | 38 | $ hg commit --config extensions.criple=$TESTTMP/criple.py -m big |
|
39 | 39 | abort: No space left on device |
|
40 | 40 | [255] |
|
41 | 41 | |
|
42 | 42 | The largefile is not created in .hg/largefiles: |
|
43 | 43 | |
|
44 | 44 | $ ls .hg/largefiles |
|
45 | 45 | dirstate |
|
46 | 46 | |
|
47 | 47 | The user cache is not even created: |
|
48 | 48 | |
|
49 | 49 | >>> import os; os.path.exists("$HOME/.cache/largefiles/") |
|
50 | 50 | False |
|
51 | 51 | |
|
52 | 52 | Make the commit with space on the device: |
|
53 | 53 | |
|
54 | 54 | $ hg commit -m big |
|
55 | 55 | |
|
56 | 56 | Now make a clone with a full disk, and make sure lfutil.link function |
|
57 | 57 | makes copies instead of hardlinks: |
|
58 | 58 | |
|
59 | 59 | $ cd .. |
|
60 | 60 | $ hg --config extensions.criple=$TESTTMP/criple.py clone --pull alice bob |
|
61 | 61 | requesting all changes |
|
62 | 62 | adding changesets |
|
63 | 63 | adding manifests |
|
64 | 64 | adding file changes |
|
65 | 65 | added 1 changesets with 1 changes to 1 files |
|
66 | 66 | new changesets 390cf214e9ac |
|
67 | 67 | updating to branch default |
|
68 | 68 | getting changed largefiles |
|
69 | 69 | abort: No space left on device |
|
70 | 70 | [255] |
|
71 | 71 | |
|
72 | 72 | The largefile is not created in .hg/largefiles: |
|
73 | 73 | |
|
74 | 74 | $ ls bob/.hg/largefiles |
|
75 | 75 | dirstate |
General Comments 0
You need to be logged in to leave comments.
Login now