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