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