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