Show More
@@ -1,202 +1,233 b'' | |||||
1 | Create user cache directory |
|
1 | Create user cache directory | |
2 |
|
2 | |||
3 | $ USERCACHE=`pwd`/cache; export USERCACHE |
|
3 | $ USERCACHE=`pwd`/cache; export USERCACHE | |
4 | $ cat <<EOF >> ${HGRCPATH} |
|
4 | $ cat <<EOF >> ${HGRCPATH} | |
5 | > [extensions] |
|
5 | > [extensions] | |
6 | > hgext.largefiles= |
|
6 | > hgext.largefiles= | |
7 | > [largefiles] |
|
7 | > [largefiles] | |
8 | > usercache=${USERCACHE} |
|
8 | > usercache=${USERCACHE} | |
9 | > EOF |
|
9 | > EOF | |
10 | $ mkdir -p ${USERCACHE} |
|
10 | $ mkdir -p ${USERCACHE} | |
11 |
|
11 | |||
12 | Create source repo, and commit adding largefile. |
|
12 | Create source repo, and commit adding largefile. | |
13 |
|
13 | |||
14 | $ hg init src |
|
14 | $ hg init src | |
15 | $ cd src |
|
15 | $ cd src | |
16 | $ echo large > large |
|
16 | $ echo large > large | |
17 | $ hg add --large large |
|
17 | $ hg add --large large | |
18 | $ hg commit -m 'add largefile' |
|
18 | $ hg commit -m 'add largefile' | |
19 | $ hg rm large |
|
19 | $ hg rm large | |
20 | $ hg commit -m 'branchhead without largefile' |
|
20 | $ hg commit -m 'branchhead without largefile' | |
21 | $ hg up -qr 0 |
|
21 | $ hg up -qr 0 | |
22 | $ cd .. |
|
22 | $ cd .. | |
23 |
|
23 | |||
24 | Discard all cached largefiles in USERCACHE |
|
24 | Discard all cached largefiles in USERCACHE | |
25 |
|
25 | |||
26 | $ rm -rf ${USERCACHE} |
|
26 | $ rm -rf ${USERCACHE} | |
27 |
|
27 | |||
28 | Create mirror repo, and pull from source without largefile: |
|
28 | Create mirror repo, and pull from source without largefile: | |
29 | "pull" is used instead of "clone" for suppression of (1) updating to |
|
29 | "pull" is used instead of "clone" for suppression of (1) updating to | |
30 | tip (= caching largefile from source repo), and (2) recording source |
|
30 | tip (= caching largefile from source repo), and (2) recording source | |
31 | repo as "default" path in .hg/hgrc. |
|
31 | repo as "default" path in .hg/hgrc. | |
32 |
|
32 | |||
33 | $ hg init mirror |
|
33 | $ hg init mirror | |
34 | $ cd mirror |
|
34 | $ cd mirror | |
35 | $ hg pull ../src |
|
35 | $ hg pull ../src | |
36 | pulling from ../src |
|
36 | pulling from ../src | |
37 | requesting all changes |
|
37 | requesting all changes | |
38 | adding changesets |
|
38 | adding changesets | |
39 | adding manifests |
|
39 | adding manifests | |
40 | adding file changes |
|
40 | adding file changes | |
41 | added 2 changesets with 1 changes to 1 files |
|
41 | added 2 changesets with 1 changes to 1 files | |
42 | (run 'hg update' to get a working copy) |
|
42 | (run 'hg update' to get a working copy) | |
43 |
|
43 | |||
44 | Update working directory to "tip", which requires largefile("large"), |
|
44 | Update working directory to "tip", which requires largefile("large"), | |
45 | but there is no cache file for it. So, hg must treat it as |
|
45 | but there is no cache file for it. So, hg must treat it as | |
46 | "missing"(!) file. |
|
46 | "missing"(!) file. | |
47 |
|
47 | |||
48 | $ hg update -r0 |
|
48 | $ hg update -r0 | |
49 | getting changed largefiles |
|
49 | getting changed largefiles | |
50 | large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob) |
|
50 | large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob) | |
51 | 0 largefiles updated, 0 removed |
|
51 | 0 largefiles updated, 0 removed | |
52 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
52 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
53 | $ hg status |
|
53 | $ hg status | |
54 | ! large |
|
54 | ! large | |
55 |
|
55 | |||
56 | Update working directory to null: this cleanup .hg/largefiles/dirstate |
|
56 | Update working directory to null: this cleanup .hg/largefiles/dirstate | |
57 |
|
57 | |||
58 | $ hg update null |
|
58 | $ hg update null | |
59 | getting changed largefiles |
|
59 | getting changed largefiles | |
60 | 0 largefiles updated, 0 removed |
|
60 | 0 largefiles updated, 0 removed | |
61 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
61 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
62 |
|
62 | |||
63 | Update working directory to tip, again. |
|
63 | Update working directory to tip, again. | |
64 |
|
64 | |||
65 | $ hg update -r0 |
|
65 | $ hg update -r0 | |
66 | getting changed largefiles |
|
66 | getting changed largefiles | |
67 | large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob) |
|
67 | large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob) | |
68 | 0 largefiles updated, 0 removed |
|
68 | 0 largefiles updated, 0 removed | |
69 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
70 | $ hg status |
|
70 | $ hg status | |
71 | ! large |
|
71 | ! large | |
72 | $ cd .. |
|
72 | $ cd .. | |
73 |
|
73 | |||
74 | Verify that largefiles from pulled branchheads are fetched, also to an empty repo |
|
74 | Verify that largefiles from pulled branchheads are fetched, also to an empty repo | |
75 |
|
75 | |||
76 | $ hg init mirror2 |
|
76 | $ hg init mirror2 | |
77 | $ hg -R mirror2 pull src -r0 |
|
77 | $ hg -R mirror2 pull src -r0 | |
78 | pulling from src |
|
78 | pulling from src | |
79 | adding changesets |
|
79 | adding changesets | |
80 | adding manifests |
|
80 | adding manifests | |
81 | adding file changes |
|
81 | adding file changes | |
82 | added 1 changesets with 1 changes to 1 files |
|
82 | added 1 changesets with 1 changes to 1 files | |
83 | (run 'hg update' to get a working copy) |
|
83 | (run 'hg update' to get a working copy) | |
84 |
|
84 | |||
85 | #if unix-permissions |
|
85 | #if unix-permissions | |
86 |
|
86 | |||
87 | Portable way to print file permissions: |
|
87 | Portable way to print file permissions: | |
88 |
|
88 | |||
89 | $ cat > ls-l.py <<EOF |
|
89 | $ cat > ls-l.py <<EOF | |
90 | > #!/usr/bin/env python |
|
90 | > #!/usr/bin/env python | |
91 | > import sys, os |
|
91 | > import sys, os | |
92 | > path = sys.argv[1] |
|
92 | > path = sys.argv[1] | |
93 | > print '%03o' % (os.lstat(path).st_mode & 0777) |
|
93 | > print '%03o' % (os.lstat(path).st_mode & 0777) | |
94 | > EOF |
|
94 | > EOF | |
95 | $ chmod +x ls-l.py |
|
95 | $ chmod +x ls-l.py | |
96 |
|
96 | |||
97 | Test that files in .hg/largefiles inherit mode from .hg/store, not |
|
97 | Test that files in .hg/largefiles inherit mode from .hg/store, not | |
98 | from file in working copy: |
|
98 | from file in working copy: | |
99 |
|
99 | |||
100 | $ cd src |
|
100 | $ cd src | |
101 | $ chmod 750 .hg/store |
|
101 | $ chmod 750 .hg/store | |
102 | $ chmod 660 large |
|
102 | $ chmod 660 large | |
103 | $ echo change >> large |
|
103 | $ echo change >> large | |
104 | $ hg commit -m change |
|
104 | $ hg commit -m change | |
105 | created new head |
|
105 | created new head | |
106 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
106 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea | |
107 | 640 |
|
107 | 640 | |
108 |
|
108 | |||
109 | Test permission of with files in .hg/largefiles created by update: |
|
109 | Test permission of with files in .hg/largefiles created by update: | |
110 |
|
110 | |||
111 | $ cd ../mirror |
|
111 | $ cd ../mirror | |
112 | $ rm -r "$USERCACHE" .hg/largefiles # avoid links |
|
112 | $ rm -r "$USERCACHE" .hg/largefiles # avoid links | |
113 | $ chmod 750 .hg/store |
|
113 | $ chmod 750 .hg/store | |
114 | $ hg pull ../src --update -q |
|
114 | $ hg pull ../src --update -q | |
115 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
115 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea | |
116 | 640 |
|
116 | 640 | |
117 |
|
117 | |||
118 | Test permission of files created by push: |
|
118 | Test permission of files created by push: | |
119 |
|
119 | |||
120 | $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \ |
|
120 | $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \ | |
121 | > --config "web.allow_push=*" --config web.push_ssl=no |
|
121 | > --config "web.allow_push=*" --config web.push_ssl=no | |
122 | $ cat hg.pid >> $DAEMON_PIDS |
|
122 | $ cat hg.pid >> $DAEMON_PIDS | |
123 |
|
123 | |||
124 | $ echo change >> large |
|
124 | $ echo change >> large | |
125 | $ hg commit -m change |
|
125 | $ hg commit -m change | |
126 |
|
126 | |||
127 | $ rm -r "$USERCACHE" |
|
127 | $ rm -r "$USERCACHE" | |
128 |
|
128 | |||
129 | $ hg push -q http://localhost:$HGPORT/ |
|
129 | $ hg push -q http://localhost:$HGPORT/ | |
130 |
|
130 | |||
131 | $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9 |
|
131 | $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9 | |
132 | 640 |
|
132 | 640 | |
133 |
|
133 | |||
134 | $ cd .. |
|
134 | $ cd .. | |
135 |
|
135 | |||
136 | #endif |
|
136 | #endif | |
137 |
|
137 | |||
138 | Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say |
|
138 | Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say | |
139 | it is missing, but a remove on a nonexistent unknown file still should. Same |
|
139 | it is missing, but a remove on a nonexistent unknown file still should. Same | |
140 | for a forget.) |
|
140 | for a forget.) | |
141 |
|
141 | |||
142 | $ cd src |
|
142 | $ cd src | |
143 | $ touch x |
|
143 | $ touch x | |
144 | $ hg add x |
|
144 | $ hg add x | |
145 | $ mv x y |
|
145 | $ mv x y | |
146 | $ hg remove -A x y ENOENT |
|
146 | $ hg remove -A x y ENOENT | |
147 | ENOENT: * (glob) |
|
147 | ENOENT: * (glob) | |
148 | not removing y: file is untracked |
|
148 | not removing y: file is untracked | |
149 | [1] |
|
149 | [1] | |
150 | $ hg add y |
|
150 | $ hg add y | |
151 | $ mv y z |
|
151 | $ mv y z | |
152 | $ hg forget y z ENOENT |
|
152 | $ hg forget y z ENOENT | |
153 | ENOENT: * (glob) |
|
153 | ENOENT: * (glob) | |
154 | not removing z: file is already untracked |
|
154 | not removing z: file is already untracked | |
155 | [1] |
|
155 | [1] | |
156 |
|
156 | |||
157 | Largefiles are accessible from the share's store |
|
157 | Largefiles are accessible from the share's store | |
158 | $ cd .. |
|
158 | $ cd .. | |
159 | $ hg share -q src share_dst --config extensions.share= |
|
159 | $ hg share -q src share_dst --config extensions.share= | |
160 | $ hg -R share_dst update -r0 |
|
160 | $ hg -R share_dst update -r0 | |
161 | getting changed largefiles |
|
161 | getting changed largefiles | |
162 | 1 largefiles updated, 0 removed |
|
162 | 1 largefiles updated, 0 removed | |
163 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
164 |
|
164 | |||
165 | $ echo modified > share_dst/large |
|
165 | $ echo modified > share_dst/large | |
166 | $ hg -R share_dst ci -m modified |
|
166 | $ hg -R share_dst ci -m modified | |
167 | created new head |
|
167 | created new head | |
168 |
|
168 | |||
169 | Only dirstate is in the local store for the share, and the largefile is in the |
|
169 | Only dirstate is in the local store for the share, and the largefile is in the | |
170 | share source's local store. Avoid the extra largefiles added in the unix |
|
170 | share source's local store. Avoid the extra largefiles added in the unix | |
171 | conditional above. |
|
171 | conditional above. | |
172 | $ hash=`hg -R share_dst cat share_dst/.hglf/large` |
|
172 | $ hash=`hg -R share_dst cat share_dst/.hglf/large` | |
173 | $ echo $hash |
|
173 | $ echo $hash | |
174 | e2fb5f2139d086ded2cb600d5a91a196e76bf020 |
|
174 | e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |
175 |
|
175 | |||
176 | $ find share_dst/.hg/largefiles/* | sort |
|
176 | $ find share_dst/.hg/largefiles/* | sort | |
177 | share_dst/.hg/largefiles/dirstate |
|
177 | share_dst/.hg/largefiles/dirstate | |
178 |
|
178 | |||
179 | $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort |
|
179 | $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort | |
180 | src/.hg/largefiles/dirstate |
|
180 | src/.hg/largefiles/dirstate | |
181 | src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 |
|
181 | src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |
182 |
|
182 | |||
183 | Inject corruption into the largefiles store and see how update handles that: |
|
183 | Inject corruption into the largefiles store and see how update handles that: | |
184 |
|
184 | |||
185 | $ cd src |
|
185 | $ cd src | |
186 | $ hg up -qC |
|
186 | $ hg up -qC | |
187 | $ cat large |
|
187 | $ cat large | |
188 | modified |
|
188 | modified | |
189 | $ rm large |
|
189 | $ rm large | |
190 | $ cat .hglf/large |
|
190 | $ cat .hglf/large | |
191 | e2fb5f2139d086ded2cb600d5a91a196e76bf020 |
|
191 | e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |
192 | $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 .. |
|
192 | $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 .. | |
193 | $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 |
|
193 | $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |
194 | $ hg up -C |
|
194 | $ hg up -C | |
195 | getting changed largefiles |
|
195 | getting changed largefiles | |
196 | large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 |
|
196 | large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 | |
197 | 0 largefiles updated, 0 removed |
|
197 | 0 largefiles updated, 0 removed | |
198 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
198 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
199 | $ hg st |
|
199 | $ hg st | |
200 | ! large |
|
200 | ! large | |
201 | ? z |
|
201 | ? z | |
202 | $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 |
|
202 | $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |
|
203 | ||||
|
204 | #if serve | |||
|
205 | ||||
|
206 | Test coverage of error handling from putlfile: | |||
|
207 | ||||
|
208 | $ mkdir $TESTTMP/mirrorcache | |||
|
209 | $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache | |||
|
210 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
211 | ||||
|
212 | (the following push fails but doesn't show why) | |||
|
213 | $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache | |||
|
214 | pushing to http://localhost:$HGPORT1/ | |||
|
215 | searching for changes | |||
|
216 | unexpected putlfile response: None | |||
|
217 | abort: remotestore: could not put $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 to remote store http://localhost:$HGPORT1/ | |||
|
218 | [255] | |||
|
219 | ||||
|
220 | $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 | |||
|
221 | ||||
|
222 | Test coverage of 'missing from store': | |||
|
223 | ||||
|
224 | $ hg serve -R ../mirror -d -p $HGPORT2 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache --config "web.allow_push=*" --config web.push_ssl=no | |||
|
225 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
226 | ||||
|
227 | $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache | |||
|
228 | pushing to http://localhost:$HGPORT2/ | |||
|
229 | searching for changes | |||
|
230 | abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded) | |||
|
231 | [255] | |||
|
232 | ||||
|
233 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now