##// END OF EJS Templates
test-largefiles: stabilize output for Windows...
Matt Harbison -
r28887:71f99560 default
parent child Browse files
Show More
@@ -1,254 +1,254 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 > #!/usr/bin/env python
96 > #!/usr/bin/env python
97 > import sys, os
97 > import sys, os
98 > path = sys.argv[1]
98 > path = sys.argv[1]
99 > print '%03o' % (os.lstat(path).st_mode & 0777)
99 > print '%03o' % (os.lstat(path).st_mode & 0777)
100 > EOF
100 > EOF
101 $ chmod +x ls-l.py
101 $ chmod +x ls-l.py
102
102
103 Test that files in .hg/largefiles inherit mode from .hg/store, not
103 Test that files in .hg/largefiles inherit mode from .hg/store, not
104 from file in working copy:
104 from file in working copy:
105
105
106 $ cd src
106 $ cd src
107 $ chmod 750 .hg/store
107 $ chmod 750 .hg/store
108 $ chmod 660 large
108 $ chmod 660 large
109 $ echo change >> large
109 $ echo change >> large
110 $ hg commit -m change
110 $ hg commit -m change
111 created new head
111 created new head
112 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
112 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
113 640
113 640
114
114
115 Test permission of with files in .hg/largefiles created by update:
115 Test permission of with files in .hg/largefiles created by update:
116
116
117 $ cd ../mirror
117 $ cd ../mirror
118 $ rm -r "$USERCACHE" .hg/largefiles # avoid links
118 $ rm -r "$USERCACHE" .hg/largefiles # avoid links
119 $ chmod 750 .hg/store
119 $ chmod 750 .hg/store
120 $ hg pull ../src --update -q
120 $ hg pull ../src --update -q
121 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
121 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
122 640
122 640
123
123
124 Test permission of files created by push:
124 Test permission of files created by push:
125
125
126 $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
126 $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
127 > --config "web.allow_push=*" --config web.push_ssl=no
127 > --config "web.allow_push=*" --config web.push_ssl=no
128 $ cat hg.pid >> $DAEMON_PIDS
128 $ cat hg.pid >> $DAEMON_PIDS
129
129
130 $ echo change >> large
130 $ echo change >> large
131 $ hg commit -m change
131 $ hg commit -m change
132
132
133 $ rm -r "$USERCACHE"
133 $ rm -r "$USERCACHE"
134
134
135 $ hg push -q http://localhost:$HGPORT/
135 $ hg push -q http://localhost:$HGPORT/
136
136
137 $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
137 $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
138 640
138 640
139
139
140 $ cd ..
140 $ cd ..
141
141
142 #endif
142 #endif
143
143
144 Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say
144 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
145 it is missing, but a remove on a nonexistent unknown file still should. Same
146 for a forget.)
146 for a forget.)
147
147
148 $ cd src
148 $ cd src
149 $ touch x
149 $ touch x
150 $ hg add x
150 $ hg add x
151 $ mv x y
151 $ mv x y
152 $ hg remove -A x y ENOENT
152 $ hg remove -A x y ENOENT
153 ENOENT: * (glob)
153 ENOENT: * (glob)
154 not removing y: file is untracked
154 not removing y: file is untracked
155 [1]
155 [1]
156 $ hg add y
156 $ hg add y
157 $ mv y z
157 $ mv y z
158 $ hg forget y z ENOENT
158 $ hg forget y z ENOENT
159 ENOENT: * (glob)
159 ENOENT: * (glob)
160 not removing z: file is already untracked
160 not removing z: file is already untracked
161 [1]
161 [1]
162
162
163 Largefiles are accessible from the share's store
163 Largefiles are accessible from the share's store
164 $ cd ..
164 $ cd ..
165 $ hg share -q src share_dst --config extensions.share=
165 $ hg share -q src share_dst --config extensions.share=
166 $ hg -R share_dst update -r0
166 $ hg -R share_dst update -r0
167 getting changed largefiles
167 getting changed largefiles
168 1 largefiles updated, 0 removed
168 1 largefiles updated, 0 removed
169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170
170
171 $ echo modified > share_dst/large
171 $ echo modified > share_dst/large
172 $ hg -R share_dst ci -m modified
172 $ hg -R share_dst ci -m modified
173 created new head
173 created new head
174
174
175 Only dirstate is in the local store for the share, and the largefile is in the
175 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
176 share source's local store. Avoid the extra largefiles added in the unix
177 conditional above.
177 conditional above.
178 $ hash=`hg -R share_dst cat share_dst/.hglf/large`
178 $ hash=`hg -R share_dst cat share_dst/.hglf/large`
179 $ echo $hash
179 $ echo $hash
180 e2fb5f2139d086ded2cb600d5a91a196e76bf020
180 e2fb5f2139d086ded2cb600d5a91a196e76bf020
181
181
182 $ find share_dst/.hg/largefiles/* | sort
182 $ find share_dst/.hg/largefiles/* | sort
183 share_dst/.hg/largefiles/dirstate
183 share_dst/.hg/largefiles/dirstate
184
184
185 $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort
185 $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort
186 src/.hg/largefiles/dirstate
186 src/.hg/largefiles/dirstate
187 src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
187 src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
188
188
189 Inject corruption into the largefiles store and see how update handles that:
189 Inject corruption into the largefiles store and see how update handles that:
190
190
191 $ cd src
191 $ cd src
192 $ hg up -qC tip
192 $ hg up -qC tip
193 $ cat large
193 $ cat large
194 modified
194 modified
195 $ rm large
195 $ rm large
196 $ cat .hglf/large
196 $ cat .hglf/large
197 e2fb5f2139d086ded2cb600d5a91a196e76bf020
197 e2fb5f2139d086ded2cb600d5a91a196e76bf020
198 $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 ..
198 $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 ..
199 $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
199 $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
200 $ hg up -C
200 $ hg up -C
201 getting changed largefiles
201 getting changed largefiles
202 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
202 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
203 0 largefiles updated, 0 removed
203 0 largefiles updated, 0 removed
204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 2 other heads for branch "default"
205 [12] other heads for branch "default" (re)
206 $ hg st
206 $ hg st
207 ! large
207 ! large
208 ? z
208 ? z
209 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
209 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
210
210
211 #if serve
211 #if serve
212
212
213 Test coverage of error handling from putlfile:
213 Test coverage of error handling from putlfile:
214
214
215 $ mkdir $TESTTMP/mirrorcache
215 $ mkdir $TESTTMP/mirrorcache
216 $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
216 $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
217 $ cat hg.pid >> $DAEMON_PIDS
217 $ cat hg.pid >> $DAEMON_PIDS
218
218
219 $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
219 $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
220 pushing to http://localhost:$HGPORT1/
220 pushing to http://localhost:$HGPORT1/
221 searching for changes
221 searching for changes
222 abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required
222 abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required
223 [255]
223 [255]
224
224
225 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
225 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
226
226
227 Test coverage of 'missing from store':
227 Test coverage of 'missing from store':
228
228
229 $ 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
229 $ 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
230 $ cat hg.pid >> $DAEMON_PIDS
230 $ cat hg.pid >> $DAEMON_PIDS
231
231
232 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
232 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
233 pushing to http://localhost:$HGPORT2/
233 pushing to http://localhost:$HGPORT2/
234 searching for changes
234 searching for changes
235 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
235 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
236 [255]
236 [255]
237
237
238 Verify that --lfrev controls which revisions are checked for largefiles to push
238 Verify that --lfrev controls which revisions are checked for largefiles to push
239
239
240 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip
240 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip
241 pushing to http://localhost:$HGPORT2/
241 pushing to http://localhost:$HGPORT2/
242 searching for changes
242 searching for changes
243 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
243 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
244 [255]
244 [255]
245
245
246 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null
246 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null
247 pushing to http://localhost:$HGPORT2/
247 pushing to http://localhost:$HGPORT2/
248 searching for changes
248 searching for changes
249 remote: adding changesets
249 remote: adding changesets
250 remote: adding manifests
250 remote: adding manifests
251 remote: adding file changes
251 remote: adding file changes
252 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
252 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
253
253
254 #endif
254 #endif
General Comments 0
You need to be logged in to leave comments. Login now