##// END OF EJS Templates
largefiles: verify status should be written as status, not as write...
Mads Kiilerich -
r18546:fb0e8966 default
parent child Browse files
Show More
@@ -1,192 +1,193 b''
1 1 # Copyright 2009-2010 Gregory P. Ward
2 2 # Copyright 2009-2010 Intelerad Medical Systems Incorporated
3 3 # Copyright 2010-2011 Fog Creek Software
4 4 # Copyright 2010-2011 Unity Technologies
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 '''base class for store implementations and store-related utility code'''
10 10
11 11 import binascii
12 12 import re
13 13
14 14 from mercurial import util, node, hg
15 15 from mercurial.i18n import _
16 16
17 17 import lfutil
18 18
19 19 class StoreError(Exception):
20 20 '''Raised when there is a problem getting files from or putting
21 21 files to a central store.'''
22 22 def __init__(self, filename, hash, url, detail):
23 23 self.filename = filename
24 24 self.hash = hash
25 25 self.url = url
26 26 self.detail = detail
27 27
28 28 def longmessage(self):
29 29 return (_("error getting id %s from url %s for file %s: %s\n") %
30 30 (self.hash, self.url, self.filename, self.detail))
31 31
32 32 def __str__(self):
33 33 return "%s: %s" % (self.url, self.detail)
34 34
35 35 class basestore(object):
36 36 def __init__(self, ui, repo, url):
37 37 self.ui = ui
38 38 self.repo = repo
39 39 self.url = url
40 40
41 41 def put(self, source, hash):
42 42 '''Put source file into the store under <filename>/<hash>.'''
43 43 raise NotImplementedError('abstract method')
44 44
45 45 def exists(self, hashes):
46 46 '''Check to see if the store contains the given hashes.'''
47 47 raise NotImplementedError('abstract method')
48 48
49 49 def get(self, files):
50 50 '''Get the specified largefiles from the store and write to local
51 51 files under repo.root. files is a list of (filename, hash)
52 52 tuples. Return (success, missing), lists of files successfully
53 53 downloaded and those not found in the store. success is a list
54 54 of (filename, hash) tuples; missing is a list of filenames that
55 55 we could not get. (The detailed error message will already have
56 56 been presented to the user, so missing is just supplied as a
57 57 summary.)'''
58 58 success = []
59 59 missing = []
60 60 ui = self.ui
61 61
62 62 at = 0
63 63 for filename, hash in files:
64 64 ui.progress(_('getting largefiles'), at, unit='lfile',
65 65 total=len(files))
66 66 at += 1
67 67 ui.note(_('getting %s:%s\n') % (filename, hash))
68 68
69 69 storefilename = lfutil.storepath(self.repo, hash)
70 70 tmpfile = util.atomictempfile(storefilename + '.tmp',
71 71 createmode=self.repo.store.createmode)
72 72
73 73 try:
74 74 hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash))
75 75 except StoreError, err:
76 76 ui.warn(err.longmessage())
77 77 hhash = ""
78 78 tmpfile.close() # has probably already been closed!
79 79
80 80 if hhash != hash:
81 81 if hhash != "":
82 82 ui.warn(_('%s: data corruption (expected %s, got %s)\n')
83 83 % (filename, hash, hhash))
84 84 util.unlink(storefilename + '.tmp')
85 85 missing.append(filename)
86 86 continue
87 87
88 88 util.rename(storefilename + '.tmp', storefilename)
89 89 lfutil.linktousercache(self.repo, hash)
90 90 success.append((filename, hhash))
91 91
92 92 ui.progress(_('getting largefiles'), None)
93 93 return (success, missing)
94 94
95 95 def verify(self, revs, contents=False):
96 96 '''Verify the existence (and, optionally, contents) of every big
97 97 file revision referenced by every changeset in revs.
98 98 Return 0 if all is well, non-zero on any errors.'''
99 write = self.ui.write
100 99 failed = False
101 100
102 write(_('searching %d changesets for largefiles\n') % len(revs))
101 self.ui.status(_('searching %d changesets for largefiles\n') %
102 len(revs))
103 103 verified = set() # set of (filename, filenode) tuples
104 104
105 105 for rev in revs:
106 106 cctx = self.repo[rev]
107 107 cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
108 108
109 109 for standin in cctx:
110 110 if self._verifyfile(cctx, cset, contents, standin, verified):
111 111 failed = True
112 112
113 113 numrevs = len(verified)
114 114 numlfiles = len(set([fname for (fname, fnode) in verified]))
115 115 if contents:
116 write(_('verified contents of %d revisions of %d largefiles\n')
117 % (numrevs, numlfiles))
116 self.ui.status(
117 _('verified contents of %d revisions of %d largefiles\n')
118 % (numrevs, numlfiles))
118 119 else:
119 write(_('verified existence of %d revisions of %d largefiles\n')
120 % (numrevs, numlfiles))
121
120 self.ui.status(
121 _('verified existence of %d revisions of %d largefiles\n')
122 % (numrevs, numlfiles))
122 123 return int(failed)
123 124
124 125 def _getfile(self, tmpfile, filename, hash):
125 126 '''Fetch one revision of one file from the store and write it
126 127 to tmpfile. Compute the hash of the file on-the-fly as it
127 128 downloads and return the binary hash. Close tmpfile. Raise
128 129 StoreError if unable to download the file (e.g. it does not
129 130 exist in the store).'''
130 131 raise NotImplementedError('abstract method')
131 132
132 133 def _verifyfile(self, cctx, cset, contents, standin, verified):
133 134 '''Perform the actual verification of a file in the store.
134 135 '''
135 136 raise NotImplementedError('abstract method')
136 137
137 138 import localstore, wirestore
138 139
139 140 _storeprovider = {
140 141 'file': [localstore.localstore],
141 142 'http': [wirestore.wirestore],
142 143 'https': [wirestore.wirestore],
143 144 'ssh': [wirestore.wirestore],
144 145 }
145 146
146 147 _scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
147 148
148 149 # During clone this function is passed the src's ui object
149 150 # but it needs the dest's ui object so it can read out of
150 151 # the config file. Use repo.ui instead.
151 152 def _openstore(repo, remote=None, put=False):
152 153 ui = repo.ui
153 154
154 155 if not remote:
155 156 lfpullsource = getattr(repo, 'lfpullsource', None)
156 157 if lfpullsource:
157 158 path = ui.expandpath(lfpullsource)
158 159 else:
159 160 path = ui.expandpath('default-push', 'default')
160 161
161 162 # ui.expandpath() leaves 'default-push' and 'default' alone if
162 163 # they cannot be expanded: fallback to the empty string,
163 164 # meaning the current directory.
164 165 if path == 'default-push' or path == 'default':
165 166 path = ''
166 167 remote = repo
167 168 else:
168 169 path, _branches = hg.parseurl(path)
169 170 remote = hg.peer(repo, {}, path)
170 171
171 172 # The path could be a scheme so use Mercurial's normal functionality
172 173 # to resolve the scheme to a repository and use its path
173 174 path = util.safehasattr(remote, 'url') and remote.url() or remote.path
174 175
175 176 match = _scheme_re.match(path)
176 177 if not match: # regular filesystem path
177 178 scheme = 'file'
178 179 else:
179 180 scheme = match.group(1)
180 181
181 182 try:
182 183 storeproviders = _storeprovider[scheme]
183 184 except KeyError:
184 185 raise util.Abort(_('unsupported URL scheme %r') % scheme)
185 186
186 187 for classobj in storeproviders:
187 188 try:
188 189 return classobj(ui, repo, remote)
189 190 except lfutil.storeprotonotcapable:
190 191 pass
191 192
192 193 raise util.Abort(_('%s does not appear to be a largefile store') % path)
@@ -1,2087 +1,2081 b''
1 1 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
2 2 $ mkdir "${USERCACHE}"
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > largefiles=
6 6 > purge=
7 7 > rebase=
8 8 > transplant=
9 9 > [phases]
10 10 > publish=False
11 11 > [largefiles]
12 12 > minsize=2
13 13 > patterns=glob:**.dat
14 14 > usercache=${USERCACHE}
15 15 > [hooks]
16 16 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
17 17 > EOF
18 18
19 19 Create the repo with a couple of revisions of both large and normal
20 20 files.
21 21 Test status and dirstate of largefiles and that summary output is correct.
22 22
23 23 $ hg init a
24 24 $ cd a
25 25 $ mkdir sub
26 26 $ echo normal1 > normal1
27 27 $ echo normal2 > sub/normal2
28 28 $ echo large1 > large1
29 29 $ echo large2 > sub/large2
30 30 $ hg add normal1 sub/normal2
31 31 $ hg add --large large1 sub/large2
32 32 $ hg commit -m "add files"
33 33 Invoking status precommit hook
34 34 A large1
35 35 A normal1
36 36 A sub/large2
37 37 A sub/normal2
38 38 $ touch large1 sub/large2
39 39 $ sleep 1
40 40 $ hg st
41 41 $ hg debugstate --nodates
42 42 n 644 41 .hglf/large1
43 43 n 644 41 .hglf/sub/large2
44 44 n 644 8 normal1
45 45 n 644 8 sub/normal2
46 46 $ hg debugstate --large
47 47 n 644 7 large1
48 48 n 644 7 sub/large2
49 49 $ echo normal11 > normal1
50 50 $ echo normal22 > sub/normal2
51 51 $ echo large11 > large1
52 52 $ echo large22 > sub/large2
53 53 $ hg commit -m "edit files"
54 54 Invoking status precommit hook
55 55 M large1
56 56 M normal1
57 57 M sub/large2
58 58 M sub/normal2
59 59 $ hg sum --large
60 60 parent: 1:ce8896473775 tip
61 61 edit files
62 62 branch: default
63 63 commit: (clean)
64 64 update: (current)
65 65 largefiles: (no remote repo)
66 66
67 67 Commit preserved largefile contents.
68 68
69 69 $ cat normal1
70 70 normal11
71 71 $ cat large1
72 72 large11
73 73 $ cat sub/normal2
74 74 normal22
75 75 $ cat sub/large2
76 76 large22
77 77
78 78 Test status, subdir and unknown files
79 79
80 80 $ echo unknown > sub/unknown
81 81 $ hg st --all
82 82 ? sub/unknown
83 83 C large1
84 84 C normal1
85 85 C sub/large2
86 86 C sub/normal2
87 87 $ hg st --all sub
88 88 ? sub/unknown
89 89 C sub/large2
90 90 C sub/normal2
91 91 $ rm sub/unknown
92 92
93 93 Test messages and exit codes for remove warning cases
94 94
95 95 $ hg remove -A large1
96 96 not removing large1: file still exists
97 97 [1]
98 98 $ echo 'modified' > large1
99 99 $ hg remove large1
100 100 not removing large1: file is modified (use -f to force removal)
101 101 [1]
102 102 $ echo 'new' > normalnew
103 103 $ hg add normalnew
104 104 $ echo 'new' > largenew
105 105 $ hg add --large normalnew
106 106 normalnew already tracked!
107 107 $ hg remove normalnew largenew
108 108 not removing largenew: file is untracked
109 109 not removing normalnew: file has been marked for add (use forget to undo)
110 110 [1]
111 111 $ rm normalnew largenew
112 112 $ hg up -Cq
113 113
114 114 Remove both largefiles and normal files.
115 115
116 116 $ hg remove normal1 large1
117 117 $ hg status large1
118 118 R large1
119 119 $ hg commit -m "remove files"
120 120 Invoking status precommit hook
121 121 R large1
122 122 R normal1
123 123 $ ls
124 124 sub
125 125 $ echo "testlargefile" > large1-test
126 126 $ hg add --large large1-test
127 127 $ hg st
128 128 A large1-test
129 129 $ hg rm large1-test
130 130 not removing large1-test: file has been marked for add (use forget to undo)
131 131 [1]
132 132 $ hg st
133 133 A large1-test
134 134 $ hg forget large1-test
135 135 $ hg st
136 136 ? large1-test
137 137 $ hg remove large1-test
138 138 not removing large1-test: file is untracked
139 139 [1]
140 140 $ hg forget large1-test
141 141 not removing large1-test: file is already untracked
142 142 [1]
143 143 $ rm large1-test
144 144
145 145 Copy both largefiles and normal files (testing that status output is correct).
146 146
147 147 $ hg cp sub/normal2 normal1
148 148 $ hg cp sub/large2 large1
149 149 $ hg commit -m "copy files"
150 150 Invoking status precommit hook
151 151 A large1
152 152 A normal1
153 153 $ cat normal1
154 154 normal22
155 155 $ cat large1
156 156 large22
157 157
158 158 Test moving largefiles and verify that normal files are also unaffected.
159 159
160 160 $ hg mv normal1 normal3
161 161 $ hg mv large1 large3
162 162 $ hg mv sub/normal2 sub/normal4
163 163 $ hg mv sub/large2 sub/large4
164 164 $ hg commit -m "move files"
165 165 Invoking status precommit hook
166 166 A large3
167 167 A normal3
168 168 A sub/large4
169 169 A sub/normal4
170 170 R large1
171 171 R normal1
172 172 R sub/large2
173 173 R sub/normal2
174 174 $ cat normal3
175 175 normal22
176 176 $ cat large3
177 177 large22
178 178 $ cat sub/normal4
179 179 normal22
180 180 $ cat sub/large4
181 181 large22
182 182
183 183 Test copies and moves from a directory other than root (issue3516)
184 184
185 185 $ cd ..
186 186 $ hg init lf_cpmv
187 187 $ cd lf_cpmv
188 188 $ mkdir dira
189 189 $ mkdir dira/dirb
190 190 $ touch dira/dirb/largefile
191 191 $ hg add --large dira/dirb/largefile
192 192 $ hg commit -m "added"
193 193 Invoking status precommit hook
194 194 A dira/dirb/largefile
195 195 $ cd dira
196 196 $ hg cp dirb/largefile foo/largefile
197 197 $ hg ci -m "deep copy"
198 198 Invoking status precommit hook
199 199 A dira/foo/largefile
200 200 $ find . | sort
201 201 .
202 202 ./dirb
203 203 ./dirb/largefile
204 204 ./foo
205 205 ./foo/largefile
206 206 $ hg mv foo/largefile baz/largefile
207 207 $ hg ci -m "moved"
208 208 Invoking status precommit hook
209 209 A dira/baz/largefile
210 210 R dira/foo/largefile
211 211 $ find . | sort
212 212 .
213 213 ./baz
214 214 ./baz/largefile
215 215 ./dirb
216 216 ./dirb/largefile
217 217 ./foo
218 218 $ cd ../../a
219 219
220 220 #if serve
221 221 Test display of largefiles in hgweb
222 222
223 223 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
224 224 $ cat ../hg.pid >> $DAEMON_PIDS
225 225 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
226 226 200 Script output follows
227 227
228 228
229 229 drwxr-xr-x sub
230 230 -rw-r--r-- 41 large3
231 231 -rw-r--r-- 9 normal3
232 232
233 233
234 234 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
235 235 200 Script output follows
236 236
237 237
238 238 -rw-r--r-- 41 large4
239 239 -rw-r--r-- 9 normal4
240 240
241 241
242 242 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
243 243 #endif
244 244
245 245 Test archiving the various revisions. These hit corner cases known with
246 246 archiving.
247 247
248 248 $ hg archive -r 0 ../archive0
249 249 $ hg archive -r 1 ../archive1
250 250 $ hg archive -r 2 ../archive2
251 251 $ hg archive -r 3 ../archive3
252 252 $ hg archive -r 4 ../archive4
253 253 $ cd ../archive0
254 254 $ cat normal1
255 255 normal1
256 256 $ cat large1
257 257 large1
258 258 $ cat sub/normal2
259 259 normal2
260 260 $ cat sub/large2
261 261 large2
262 262 $ cd ../archive1
263 263 $ cat normal1
264 264 normal11
265 265 $ cat large1
266 266 large11
267 267 $ cat sub/normal2
268 268 normal22
269 269 $ cat sub/large2
270 270 large22
271 271 $ cd ../archive2
272 272 $ ls
273 273 sub
274 274 $ cat sub/normal2
275 275 normal22
276 276 $ cat sub/large2
277 277 large22
278 278 $ cd ../archive3
279 279 $ cat normal1
280 280 normal22
281 281 $ cat large1
282 282 large22
283 283 $ cat sub/normal2
284 284 normal22
285 285 $ cat sub/large2
286 286 large22
287 287 $ cd ../archive4
288 288 $ cat normal3
289 289 normal22
290 290 $ cat large3
291 291 large22
292 292 $ cat sub/normal4
293 293 normal22
294 294 $ cat sub/large4
295 295 large22
296 296
297 297 Commit corner case: specify files to commit.
298 298
299 299 $ cd ../a
300 300 $ echo normal3 > normal3
301 301 $ echo large3 > large3
302 302 $ echo normal4 > sub/normal4
303 303 $ echo large4 > sub/large4
304 304 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
305 305 Invoking status precommit hook
306 306 M large3
307 307 M normal3
308 308 M sub/large4
309 309 M sub/normal4
310 310 $ cat normal3
311 311 normal3
312 312 $ cat large3
313 313 large3
314 314 $ cat sub/normal4
315 315 normal4
316 316 $ cat sub/large4
317 317 large4
318 318
319 319 One more commit corner case: commit from a subdirectory.
320 320
321 321 $ cd ../a
322 322 $ echo normal33 > normal3
323 323 $ echo large33 > large3
324 324 $ echo normal44 > sub/normal4
325 325 $ echo large44 > sub/large4
326 326 $ cd sub
327 327 $ hg commit -m "edit files yet again"
328 328 Invoking status precommit hook
329 329 M large3
330 330 M normal3
331 331 M sub/large4
332 332 M sub/normal4
333 333 $ cat ../normal3
334 334 normal33
335 335 $ cat ../large3
336 336 large33
337 337 $ cat normal4
338 338 normal44
339 339 $ cat large4
340 340 large44
341 341
342 342 Committing standins is not allowed.
343 343
344 344 $ cd ..
345 345 $ echo large3 > large3
346 346 $ hg commit .hglf/large3 -m "try to commit standin"
347 347 abort: file ".hglf/large3" is a largefile standin
348 348 (commit the largefile itself instead)
349 349 [255]
350 350
351 351 Corner cases for adding largefiles.
352 352
353 353 $ echo large5 > large5
354 354 $ hg add --large large5
355 355 $ hg add --large large5
356 356 large5 already a largefile
357 357 $ mkdir sub2
358 358 $ echo large6 > sub2/large6
359 359 $ echo large7 > sub2/large7
360 360 $ hg add --large sub2
361 361 adding sub2/large6 as a largefile (glob)
362 362 adding sub2/large7 as a largefile (glob)
363 363 $ hg st
364 364 M large3
365 365 A large5
366 366 A sub2/large6
367 367 A sub2/large7
368 368
369 369 Committing directories containing only largefiles.
370 370
371 371 $ mkdir -p z/y/x/m
372 372 $ touch z/y/x/m/large1
373 373 $ touch z/y/x/large2
374 374 $ hg add --large z/y/x/m/large1 z/y/x/large2
375 375 $ hg commit -m "Subdir with directory only containing largefiles" z
376 376 Invoking status precommit hook
377 377 M large3
378 378 A large5
379 379 A sub2/large6
380 380 A sub2/large7
381 381 A z/y/x/large2
382 382 A z/y/x/m/large1
383 383 $ hg rollback --quiet
384 384 $ touch z/y/x/m/normal
385 385 $ hg add z/y/x/m/normal
386 386 $ hg commit -m "Subdir with mixed contents" z
387 387 Invoking status precommit hook
388 388 M large3
389 389 A large5
390 390 A sub2/large6
391 391 A sub2/large7
392 392 A z/y/x/large2
393 393 A z/y/x/m/large1
394 394 A z/y/x/m/normal
395 395 $ hg st
396 396 M large3
397 397 A large5
398 398 A sub2/large6
399 399 A sub2/large7
400 400 $ hg rollback --quiet
401 401 $ hg revert z/y/x/large2 z/y/x/m/large1
402 402 $ rm z/y/x/large2 z/y/x/m/large1
403 403 $ hg commit -m "Subdir with normal contents" z
404 404 Invoking status precommit hook
405 405 M large3
406 406 A large5
407 407 A sub2/large6
408 408 A sub2/large7
409 409 A z/y/x/m/normal
410 410 $ hg st
411 411 M large3
412 412 A large5
413 413 A sub2/large6
414 414 A sub2/large7
415 415 $ hg rollback --quiet
416 416 $ hg revert --quiet z
417 417 $ hg commit -m "Empty subdir" z
418 418 abort: z: no match under directory!
419 419 [255]
420 420 $ rm -rf z
421 421 $ hg ci -m "standin" .hglf
422 422 abort: file ".hglf" is a largefile standin
423 423 (commit the largefile itself instead)
424 424 [255]
425 425
426 426 Test "hg status" with combination of 'file pattern' and 'directory
427 427 pattern' for largefiles:
428 428
429 429 $ hg status sub2/large6 sub2
430 430 A sub2/large6
431 431 A sub2/large7
432 432
433 433 Config settings (pattern **.dat, minsize 2 MB) are respected.
434 434
435 435 $ echo testdata > test.dat
436 436 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
437 437 $ hg add
438 438 adding reallylarge as a largefile
439 439 adding test.dat as a largefile
440 440
441 441 Test that minsize and --lfsize handle float values;
442 442 also tests that --lfsize overrides largefiles.minsize.
443 443 (0.250 MB = 256 kB = 262144 B)
444 444
445 445 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
446 446 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
447 447 $ hg --config largefiles.minsize=.25 add
448 448 adding ratherlarge as a largefile
449 449 adding medium
450 450 $ hg forget medium
451 451 $ hg --config largefiles.minsize=.25 add --lfsize=.125
452 452 adding medium as a largefile
453 453 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
454 454 $ hg --config largefiles.minsize=.25 add --lfsize=.125
455 455 adding notlarge
456 456 $ hg forget notlarge
457 457
458 458 Test forget on largefiles.
459 459
460 460 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
461 461 $ hg commit -m "add/edit more largefiles"
462 462 Invoking status precommit hook
463 463 A sub2/large6
464 464 A sub2/large7
465 465 R large3
466 466 ? large5
467 467 ? medium
468 468 ? notlarge
469 469 ? ratherlarge
470 470 ? reallylarge
471 471 ? test.dat
472 472 $ hg st
473 473 ? large3
474 474 ? large5
475 475 ? medium
476 476 ? notlarge
477 477 ? ratherlarge
478 478 ? reallylarge
479 479 ? test.dat
480 480
481 481 Purge with largefiles: verify that largefiles are still in the working
482 482 dir after a purge.
483 483
484 484 $ hg purge --all
485 485 $ cat sub/large4
486 486 large44
487 487 $ cat sub2/large6
488 488 large6
489 489 $ cat sub2/large7
490 490 large7
491 491
492 492 Test addremove: verify that files that should be added as largfiles are added as
493 493 such and that already-existing largfiles are not added as normal files by
494 494 accident.
495 495
496 496 $ rm normal3
497 497 $ rm sub/large4
498 498 $ echo "testing addremove with patterns" > testaddremove.dat
499 499 $ echo "normaladdremove" > normaladdremove
500 500 $ hg addremove
501 501 removing sub/large4
502 502 adding testaddremove.dat as a largefile
503 503 removing normal3
504 504 adding normaladdremove
505 505
506 506 Test addremove with -R
507 507
508 508 $ hg up -C
509 509 getting changed largefiles
510 510 1 largefiles updated, 0 removed
511 511 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
512 512 $ rm normal3
513 513 $ rm sub/large4
514 514 $ echo "testing addremove with patterns" > testaddremove.dat
515 515 $ echo "normaladdremove" > normaladdremove
516 516 $ cd ..
517 517 $ hg -R a addremove
518 518 removing sub/large4
519 519 adding a/testaddremove.dat as a largefile (glob)
520 520 removing normal3
521 521 adding normaladdremove
522 522 $ cd a
523 523
524 524 Test 3364
525 525 $ hg clone . ../addrm
526 526 updating to branch default
527 527 getting changed largefiles
528 528 3 largefiles updated, 0 removed
529 529 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
530 530 $ cd ../addrm
531 531 $ cat >> .hg/hgrc <<EOF
532 532 > [hooks]
533 533 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
534 534 > EOF
535 535 $ touch foo
536 536 $ hg add --large foo
537 537 $ hg ci -m "add foo"
538 538 Invoking status precommit hook
539 539 A foo
540 540 Invoking status postcommit hook
541 541 C foo
542 542 C normal3
543 543 C sub/large4
544 544 C sub/normal4
545 545 C sub2/large6
546 546 C sub2/large7
547 547 $ rm foo
548 548 $ hg st
549 549 ! foo
550 550 hmm.. no precommit invoked, but there is a postcommit??
551 551 $ hg ci -m "will not checkin"
552 552 nothing changed
553 553 Invoking status postcommit hook
554 554 ! foo
555 555 C normal3
556 556 C sub/large4
557 557 C sub/normal4
558 558 C sub2/large6
559 559 C sub2/large7
560 560 [1]
561 561 $ hg addremove
562 562 removing foo
563 563 $ hg st
564 564 R foo
565 565 $ hg ci -m "used to say nothing changed"
566 566 Invoking status precommit hook
567 567 R foo
568 568 Invoking status postcommit hook
569 569 C normal3
570 570 C sub/large4
571 571 C sub/normal4
572 572 C sub2/large6
573 573 C sub2/large7
574 574 $ hg st
575 575
576 576 Test 3507 (both normal files and largefiles were a problem)
577 577
578 578 $ touch normal
579 579 $ touch large
580 580 $ hg add normal
581 581 $ hg add --large large
582 582 $ hg ci -m "added"
583 583 Invoking status precommit hook
584 584 A large
585 585 A normal
586 586 Invoking status postcommit hook
587 587 C large
588 588 C normal
589 589 C normal3
590 590 C sub/large4
591 591 C sub/normal4
592 592 C sub2/large6
593 593 C sub2/large7
594 594 $ hg remove normal
595 595 $ hg addremove --traceback
596 596 $ hg ci -m "addremoved normal"
597 597 Invoking status precommit hook
598 598 R normal
599 599 Invoking status postcommit hook
600 600 C large
601 601 C normal3
602 602 C sub/large4
603 603 C sub/normal4
604 604 C sub2/large6
605 605 C sub2/large7
606 606 $ hg up -C '.^'
607 607 getting changed largefiles
608 608 0 largefiles updated, 0 removed
609 609 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
610 610 $ hg remove large
611 611 $ hg addremove --traceback
612 612 $ hg ci -m "removed large"
613 613 Invoking status precommit hook
614 614 R large
615 615 created new head
616 616 Invoking status postcommit hook
617 617 C normal
618 618 C normal3
619 619 C sub/large4
620 620 C sub/normal4
621 621 C sub2/large6
622 622 C sub2/large7
623 623
624 624 Test commit -A (issue 3542)
625 625 $ echo large8 > large8
626 626 $ hg add --large large8
627 627 $ hg ci -Am 'this used to add large8 as normal and commit both'
628 628 Invoking status precommit hook
629 629 A large8
630 630 Invoking status postcommit hook
631 631 C large8
632 632 C normal
633 633 C normal3
634 634 C sub/large4
635 635 C sub/normal4
636 636 C sub2/large6
637 637 C sub2/large7
638 638 $ rm large8
639 639 $ hg ci -Am 'this used to not notice the rm'
640 640 removing large8
641 641 Invoking status precommit hook
642 642 R large8
643 643 Invoking status postcommit hook
644 644 C normal
645 645 C normal3
646 646 C sub/large4
647 647 C sub/normal4
648 648 C sub2/large6
649 649 C sub2/large7
650 650
651 651 Test that a standin can't be added as a large file
652 652
653 653 $ touch large
654 654 $ hg add --large large
655 655 $ hg ci -m "add"
656 656 Invoking status precommit hook
657 657 A large
658 658 Invoking status postcommit hook
659 659 C large
660 660 C normal
661 661 C normal3
662 662 C sub/large4
663 663 C sub/normal4
664 664 C sub2/large6
665 665 C sub2/large7
666 666 $ hg remove large
667 667 $ touch large
668 668 $ hg addremove --config largefiles.patterns=**large --traceback
669 669 adding large as a largefile
670 670
671 671 Test that outgoing --large works (with revsets too)
672 672 $ hg outgoing --rev '.^' --large
673 673 comparing with $TESTTMP/a (glob)
674 674 searching for changes
675 675 changeset: 8:c02fd3b77ec4
676 676 user: test
677 677 date: Thu Jan 01 00:00:00 1970 +0000
678 678 summary: add foo
679 679
680 680 changeset: 9:289dd08c9bbb
681 681 user: test
682 682 date: Thu Jan 01 00:00:00 1970 +0000
683 683 summary: used to say nothing changed
684 684
685 685 changeset: 10:34f23ac6ac12
686 686 user: test
687 687 date: Thu Jan 01 00:00:00 1970 +0000
688 688 summary: added
689 689
690 690 changeset: 12:710c1b2f523c
691 691 parent: 10:34f23ac6ac12
692 692 user: test
693 693 date: Thu Jan 01 00:00:00 1970 +0000
694 694 summary: removed large
695 695
696 696 changeset: 13:0a3e75774479
697 697 user: test
698 698 date: Thu Jan 01 00:00:00 1970 +0000
699 699 summary: this used to add large8 as normal and commit both
700 700
701 701 changeset: 14:84f3d378175c
702 702 user: test
703 703 date: Thu Jan 01 00:00:00 1970 +0000
704 704 summary: this used to not notice the rm
705 705
706 706 searching for changes
707 707 largefiles to upload:
708 708 foo
709 709 large
710 710 large8
711 711
712 712 $ cd ../a
713 713
714 714 Clone a largefiles repo.
715 715
716 716 $ hg clone . ../b
717 717 updating to branch default
718 718 getting changed largefiles
719 719 3 largefiles updated, 0 removed
720 720 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
721 721 $ cd ../b
722 722 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
723 723 7:daea875e9014 add/edit more largefiles
724 724 6:4355d653f84f edit files yet again
725 725 5:9d5af5072dbd edit files again
726 726 4:74c02385b94c move files
727 727 3:9e8fbc4bce62 copy files
728 728 2:51a0ae4d5864 remove files
729 729 1:ce8896473775 edit files
730 730 0:30d30fe6a5be add files
731 731 $ cat normal3
732 732 normal33
733 733 $ cat sub/normal4
734 734 normal44
735 735 $ cat sub/large4
736 736 large44
737 737 $ cat sub2/large6
738 738 large6
739 739 $ cat sub2/large7
740 740 large7
741 741 $ cd ..
742 742 $ hg clone a -r 3 c
743 743 adding changesets
744 744 adding manifests
745 745 adding file changes
746 746 added 4 changesets with 10 changes to 4 files
747 747 updating to branch default
748 748 getting changed largefiles
749 749 2 largefiles updated, 0 removed
750 750 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
751 751 $ cd c
752 752 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
753 753 3:9e8fbc4bce62 copy files
754 754 2:51a0ae4d5864 remove files
755 755 1:ce8896473775 edit files
756 756 0:30d30fe6a5be add files
757 757 $ cat normal1
758 758 normal22
759 759 $ cat large1
760 760 large22
761 761 $ cat sub/normal2
762 762 normal22
763 763 $ cat sub/large2
764 764 large22
765 765
766 766 Old revisions of a clone have correct largefiles content (this also
767 767 tests update).
768 768
769 769 $ hg update -r 1
770 770 getting changed largefiles
771 771 1 largefiles updated, 0 removed
772 772 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
773 773 $ cat large1
774 774 large11
775 775 $ cat sub/large2
776 776 large22
777 777 $ cd ..
778 778
779 779 Test cloning with --all-largefiles flag
780 780
781 781 $ rm "${USERCACHE}"/*
782 782 $ hg clone --all-largefiles a a-backup
783 783 updating to branch default
784 784 getting changed largefiles
785 785 3 largefiles updated, 0 removed
786 786 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
787 787 8 additional largefiles cached
788 788
789 789 $ rm "${USERCACHE}"/*
790 790 $ hg clone --all-largefiles -u 0 a a-clone0
791 791 updating to branch default
792 792 getting changed largefiles
793 793 2 largefiles updated, 0 removed
794 794 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
795 795 9 additional largefiles cached
796 796 $ hg -R a-clone0 sum
797 797 parent: 0:30d30fe6a5be
798 798 add files
799 799 branch: default
800 800 commit: (clean)
801 801 update: 7 new changesets (update)
802 802
803 803 $ rm "${USERCACHE}"/*
804 804 $ hg clone --all-largefiles -u 1 a a-clone1
805 805 updating to branch default
806 806 getting changed largefiles
807 807 2 largefiles updated, 0 removed
808 808 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
809 809 8 additional largefiles cached
810 810 $ hg -R a-clone1 verify --large --lfa --lfc
811 811 checking changesets
812 812 checking manifests
813 813 crosschecking files in changesets and manifests
814 814 checking files
815 815 10 files, 8 changesets, 24 total revisions
816 816 searching 8 changesets for largefiles
817 817 verified contents of 13 revisions of 6 largefiles
818 818 $ hg -R a-clone1 sum
819 819 parent: 1:ce8896473775
820 820 edit files
821 821 branch: default
822 822 commit: (clean)
823 823 update: 6 new changesets (update)
824 824
825 825 $ rm "${USERCACHE}"/*
826 826 $ hg clone --all-largefiles -U a a-clone-u
827 827 11 additional largefiles cached
828 828 $ hg -R a-clone-u sum
829 829 parent: -1:000000000000 (no revision checked out)
830 830 branch: default
831 831 commit: (clean)
832 832 update: 8 new changesets (update)
833 833
834 834 $ mkdir xyz
835 835 $ cd xyz
836 836 $ hg clone ../a
837 837 destination directory: a
838 838 updating to branch default
839 839 getting changed largefiles
840 840 3 largefiles updated, 0 removed
841 841 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
842 842 $ cd ..
843 843
844 844 Ensure base clone command argument validation
845 845
846 846 $ hg clone -U -u 0 a a-clone-failure
847 847 abort: cannot specify both --noupdate and --updaterev
848 848 [255]
849 849
850 850 $ hg clone --all-largefiles a ssh://localhost/a
851 851 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
852 852 [255]
853 853
854 854 Test pulling with --all-largefiles flag. Also test that the largefiles are
855 855 downloaded from 'default' instead of 'default-push' when no source is specified
856 856 (issue3584)
857 857
858 858 $ rm -Rf a-backup
859 859 $ hg clone -r 1 a a-backup
860 860 adding changesets
861 861 adding manifests
862 862 adding file changes
863 863 added 2 changesets with 8 changes to 4 files
864 864 updating to branch default
865 865 getting changed largefiles
866 866 2 largefiles updated, 0 removed
867 867 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
868 868 $ rm "${USERCACHE}"/*
869 869 $ cd a-backup
870 870 $ hg pull --all-largefiles --config paths.default-push=bogus/path
871 871 pulling from $TESTTMP/a (glob)
872 872 searching for changes
873 873 adding changesets
874 874 adding manifests
875 875 adding file changes
876 876 added 6 changesets with 16 changes to 8 files
877 877 (run 'hg update' to get a working copy)
878 878 caching new largefiles
879 879 3 largefiles cached
880 880 3 additional largefiles cached
881 881 $ cd ..
882 882
883 883 Rebasing between two repositories does not revert largefiles to old
884 884 revisions (this was a very bad bug that took a lot of work to fix).
885 885
886 886 $ hg clone a d
887 887 updating to branch default
888 888 getting changed largefiles
889 889 3 largefiles updated, 0 removed
890 890 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
891 891 $ cd b
892 892 $ echo large4-modified > sub/large4
893 893 $ echo normal3-modified > normal3
894 894 $ hg commit -m "modify normal file and largefile in repo b"
895 895 Invoking status precommit hook
896 896 M normal3
897 897 M sub/large4
898 898 $ cd ../d
899 899 $ echo large6-modified > sub2/large6
900 900 $ echo normal4-modified > sub/normal4
901 901 $ hg commit -m "modify normal file largefile in repo d"
902 902 Invoking status precommit hook
903 903 M sub/normal4
904 904 M sub2/large6
905 905 $ cd ..
906 906 $ hg clone d e
907 907 updating to branch default
908 908 getting changed largefiles
909 909 3 largefiles updated, 0 removed
910 910 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
911 911 $ cd d
912 912
913 913 More rebase testing, but also test that the largefiles are downloaded from
914 914 'default' instead of 'default-push' when no source is specified (issue3584).
915 915 The error messages go away if repo 'b' is created with --all-largefiles.
916 916 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
917 917 pulling from $TESTTMP/b (glob)
918 918 searching for changes
919 919 adding changesets
920 920 adding manifests
921 921 adding file changes
922 922 added 1 changesets with 2 changes to 2 files (+1 heads)
923 923 Invoking status precommit hook
924 924 M sub/normal4
925 925 M sub2/large6
926 926 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
927 927 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file large3: can't get file locally (glob)
928 928 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file sub/large4: can't get file locally (glob)
929 929 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file large1: can't get file locally (glob)
930 930 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file sub/large2: can't get file locally (glob)
931 931 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file sub/large2: can't get file locally (glob)
932 932 error getting id 5f78770c0e77ba4287ad6ef3071c9bf9c379742f from url file:$TESTTMP/b for file large1: can't get file locally (glob)
933 933 error getting id eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from url file:$TESTTMP/b for file sub/large2: can't get file locally (glob)
934 934 error getting id 4669e532d5b2c093a78eca010077e708a071bb64 from url file:$TESTTMP/b for file large1: can't get file locally (glob)
935 935 error getting id 1deebade43c8c498a3c8daddac0244dc55d1331d from url file:$TESTTMP/b for file sub/large2: can't get file locally (glob)
936 936 0 additional largefiles cached
937 937 9 largefiles failed to download
938 938 nothing to rebase
939 939 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
940 940 9:598410d3eb9a modify normal file largefile in repo d
941 941 8:a381d2c8c80e modify normal file and largefile in repo b
942 942 7:daea875e9014 add/edit more largefiles
943 943 6:4355d653f84f edit files yet again
944 944 5:9d5af5072dbd edit files again
945 945 4:74c02385b94c move files
946 946 3:9e8fbc4bce62 copy files
947 947 2:51a0ae4d5864 remove files
948 948 1:ce8896473775 edit files
949 949 0:30d30fe6a5be add files
950 950 $ cat normal3
951 951 normal3-modified
952 952 $ cat sub/normal4
953 953 normal4-modified
954 954 $ cat sub/large4
955 955 large4-modified
956 956 $ cat sub2/large6
957 957 large6-modified
958 958 $ cat sub2/large7
959 959 large7
960 960 $ cd ../e
961 961 $ hg pull ../b
962 962 pulling from ../b
963 963 searching for changes
964 964 adding changesets
965 965 adding manifests
966 966 adding file changes
967 967 added 1 changesets with 2 changes to 2 files (+1 heads)
968 968 (run 'hg heads' to see heads, 'hg merge' to merge)
969 969 caching new largefiles
970 970 0 largefiles cached
971 971 $ hg rebase
972 972 Invoking status precommit hook
973 973 M sub/normal4
974 974 M sub2/large6
975 975 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
976 976 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
977 977 9:598410d3eb9a modify normal file largefile in repo d
978 978 8:a381d2c8c80e modify normal file and largefile in repo b
979 979 7:daea875e9014 add/edit more largefiles
980 980 6:4355d653f84f edit files yet again
981 981 5:9d5af5072dbd edit files again
982 982 4:74c02385b94c move files
983 983 3:9e8fbc4bce62 copy files
984 984 2:51a0ae4d5864 remove files
985 985 1:ce8896473775 edit files
986 986 0:30d30fe6a5be add files
987 987 $ cat normal3
988 988 normal3-modified
989 989 $ cat sub/normal4
990 990 normal4-modified
991 991 $ cat sub/large4
992 992 large4-modified
993 993 $ cat sub2/large6
994 994 large6-modified
995 995 $ cat sub2/large7
996 996 large7
997 997
998 998 Log on largefiles
999 999
1000 1000 - same output
1001 1001 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1002 1002 8:a381d2c8c80e modify normal file and largefile in repo b
1003 1003 6:4355d653f84f edit files yet again
1004 1004 5:9d5af5072dbd edit files again
1005 1005 4:74c02385b94c move files
1006 1006 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1007 1007 8:a381d2c8c80e modify normal file and largefile in repo b
1008 1008 6:4355d653f84f edit files yet again
1009 1009 5:9d5af5072dbd edit files again
1010 1010 4:74c02385b94c move files
1011 1011
1012 1012 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1013 1013 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1014 1014 8:a381d2c8c80e modify normal file and largefile in repo b
1015 1015 6:4355d653f84f edit files yet again
1016 1016 5:9d5af5072dbd edit files again
1017 1017 4:74c02385b94c move files
1018 1018 1:ce8896473775 edit files
1019 1019 0:30d30fe6a5be add files
1020 1020 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1021 1021 9:598410d3eb9a modify normal file largefile in repo d
1022 1022 8:a381d2c8c80e modify normal file and largefile in repo b
1023 1023 6:4355d653f84f edit files yet again
1024 1024 5:9d5af5072dbd edit files again
1025 1025 4:74c02385b94c move files
1026 1026 1:ce8896473775 edit files
1027 1027 0:30d30fe6a5be add files
1028 1028
1029 1029 - globbing gives same result
1030 1030 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1031 1031 9:598410d3eb9a modify normal file largefile in repo d
1032 1032 8:a381d2c8c80e modify normal file and largefile in repo b
1033 1033 6:4355d653f84f edit files yet again
1034 1034 5:9d5af5072dbd edit files again
1035 1035 4:74c02385b94c move files
1036 1036 1:ce8896473775 edit files
1037 1037 0:30d30fe6a5be add files
1038 1038
1039 1039 Rollback on largefiles.
1040 1040
1041 1041 $ echo large4-modified-again > sub/large4
1042 1042 $ hg commit -m "Modify large4 again"
1043 1043 Invoking status precommit hook
1044 1044 M sub/large4
1045 1045 $ hg rollback
1046 1046 repository tip rolled back to revision 9 (undo commit)
1047 1047 working directory now based on revision 9
1048 1048 $ hg st
1049 1049 M sub/large4
1050 1050 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1051 1051 9:598410d3eb9a modify normal file largefile in repo d
1052 1052 8:a381d2c8c80e modify normal file and largefile in repo b
1053 1053 7:daea875e9014 add/edit more largefiles
1054 1054 6:4355d653f84f edit files yet again
1055 1055 5:9d5af5072dbd edit files again
1056 1056 4:74c02385b94c move files
1057 1057 3:9e8fbc4bce62 copy files
1058 1058 2:51a0ae4d5864 remove files
1059 1059 1:ce8896473775 edit files
1060 1060 0:30d30fe6a5be add files
1061 1061 $ cat sub/large4
1062 1062 large4-modified-again
1063 1063
1064 1064 "update --check" refuses to update with uncommitted changes.
1065 1065 $ hg update --check 8
1066 1066 abort: uncommitted local changes
1067 1067 [255]
1068 1068
1069 1069 "update --clean" leaves correct largefiles in working copy, even when there is
1070 1070 .orig files from revert in .hglf.
1071 1071
1072 1072 $ echo mistake > sub2/large7
1073 1073 $ hg revert sub2/large7
1074 1074 $ hg -q update --clean -r null
1075 1075 $ hg update --clean
1076 1076 getting changed largefiles
1077 1077 3 largefiles updated, 0 removed
1078 1078 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1079 1079 $ cat normal3
1080 1080 normal3-modified
1081 1081 $ cat sub/normal4
1082 1082 normal4-modified
1083 1083 $ cat sub/large4
1084 1084 large4-modified
1085 1085 $ cat sub2/large6
1086 1086 large6-modified
1087 1087 $ cat sub2/large7
1088 1088 large7
1089 1089 $ cat sub2/large7.orig
1090 1090 mistake
1091 1091 $ cat .hglf/sub2/large7.orig
1092 1092 9dbfb2c79b1c40981b258c3efa1b10b03f18ad31
1093 1093
1094 1094 demonstrate misfeature: .orig file is overwritten on every update -C,
1095 1095 also when clean:
1096 1096 $ hg update --clean
1097 1097 getting changed largefiles
1098 1098 0 largefiles updated, 0 removed
1099 1099 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1100 1100 $ cat sub2/large7.orig
1101 1101 large7
1102 1102 $ rm sub2/large7.orig .hglf/sub2/large7.orig
1103 1103
1104 1104 Now "update check" is happy.
1105 1105 $ hg update --check 8
1106 1106 getting changed largefiles
1107 1107 1 largefiles updated, 0 removed
1108 1108 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1109 1109 $ hg update --check
1110 1110 getting changed largefiles
1111 1111 1 largefiles updated, 0 removed
1112 1112 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1113 1113
1114 1114 Test removing empty largefiles directories on update
1115 1115 $ test -d sub2 && echo "sub2 exists"
1116 1116 sub2 exists
1117 1117 $ hg update -q null
1118 1118 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1119 1119 [1]
1120 1120 $ hg update -q
1121 1121
1122 1122 Test hg remove removes empty largefiles directories
1123 1123 $ test -d sub2 && echo "sub2 exists"
1124 1124 sub2 exists
1125 1125 $ hg remove sub2/*
1126 1126 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1127 1127 [1]
1128 1128 $ hg revert sub2/large6 sub2/large7
1129 1129
1130 1130 "revert" works on largefiles (and normal files too).
1131 1131 $ echo hack3 >> normal3
1132 1132 $ echo hack4 >> sub/normal4
1133 1133 $ echo hack4 >> sub/large4
1134 1134 $ rm sub2/large6
1135 1135 $ hg revert sub2/large6
1136 1136 $ hg rm sub2/large6
1137 1137 $ echo new >> sub2/large8
1138 1138 $ hg add --large sub2/large8
1139 1139 # XXX we don't really want to report that we're reverting the standin;
1140 1140 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1141 1141 $ hg revert sub
1142 1142 reverting .hglf/sub/large4 (glob)
1143 1143 reverting sub/normal4 (glob)
1144 1144 $ hg status
1145 1145 M normal3
1146 1146 A sub2/large8
1147 1147 R sub2/large6
1148 1148 ? sub/large4.orig
1149 1149 ? sub/normal4.orig
1150 1150 $ cat sub/normal4
1151 1151 normal4-modified
1152 1152 $ cat sub/large4
1153 1153 large4-modified
1154 1154 $ hg revert -a --no-backup
1155 1155 undeleting .hglf/sub2/large6 (glob)
1156 1156 forgetting .hglf/sub2/large8 (glob)
1157 1157 reverting normal3
1158 1158 $ hg status
1159 1159 ? sub/large4.orig
1160 1160 ? sub/normal4.orig
1161 1161 ? sub2/large8
1162 1162 $ cat normal3
1163 1163 normal3-modified
1164 1164 $ cat sub2/large6
1165 1165 large6-modified
1166 1166 $ rm sub/*.orig sub2/large8
1167 1167
1168 1168 revert some files to an older revision
1169 1169 $ hg revert --no-backup -r 8 sub2
1170 1170 reverting .hglf/sub2/large6 (glob)
1171 1171 $ cat sub2/large6
1172 1172 large6
1173 1173 $ hg revert --no-backup -C -r '.^' sub2
1174 1174 reverting .hglf/sub2/large6 (glob)
1175 1175 $ hg revert --no-backup sub2
1176 1176 reverting .hglf/sub2/large6 (glob)
1177 1177 $ hg status
1178 1178
1179 1179 "verify --large" actually verifies largefiles
1180 1180
1181 1181 - Where Do We Come From? What Are We? Where Are We Going?
1182 1182 $ pwd
1183 1183 $TESTTMP/e
1184 1184 $ hg paths
1185 1185 default = $TESTTMP/d (glob)
1186 1186
1187 1187 $ hg verify --large
1188 1188 checking changesets
1189 1189 checking manifests
1190 1190 crosschecking files in changesets and manifests
1191 1191 checking files
1192 1192 10 files, 10 changesets, 28 total revisions
1193 1193 searching 1 changesets for largefiles
1194 1194 verified existence of 3 revisions of 3 largefiles
1195 1195
1196 1196 - introduce missing blob in local store repo and make sure that this is caught:
1197 1197 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1198 1198 $ hg verify --large
1199 1199 checking changesets
1200 1200 checking manifests
1201 1201 crosschecking files in changesets and manifests
1202 1202 checking files
1203 1203 10 files, 10 changesets, 28 total revisions
1204 1204 searching 1 changesets for largefiles
1205 1205 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1206 1206 verified existence of 3 revisions of 3 largefiles
1207 1207 [1]
1208 1208
1209 1209 - introduce corruption and make sure that it is caught when checking content:
1210 1210 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1211 1211 $ hg verify -q --large --lfc
1212 searching 1 changesets for largefiles
1213 1212 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1214 verified contents of 3 revisions of 3 largefiles
1215 1213 [1]
1216 1214
1217 1215 - cleanup
1218 1216 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1219 1217
1220 1218 - verifying all revisions will fail because we didn't clone all largefiles to d:
1221 1219 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1222 1220 $ hg verify -q --large --lfa --lfc
1223 searching 10 changesets for largefiles
1224 1221 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
1225 1222 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
1226 1223 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
1227 1224 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1228 1225 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1229 1226 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1230 1227 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1231 verified contents of 15 revisions of 6 largefiles
1232 1228 [1]
1233 1229
1234 1230 - cleanup
1235 1231 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1236 1232
1237 1233 Merging does not revert to old versions of largefiles and also check
1238 1234 that merging after having pulled from a non-default remote works
1239 1235 correctly.
1240 1236
1241 1237 $ cd ..
1242 1238 $ hg clone -r 7 e temp
1243 1239 adding changesets
1244 1240 adding manifests
1245 1241 adding file changes
1246 1242 added 8 changesets with 24 changes to 10 files
1247 1243 updating to branch default
1248 1244 getting changed largefiles
1249 1245 3 largefiles updated, 0 removed
1250 1246 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1251 1247 $ hg clone temp f
1252 1248 updating to branch default
1253 1249 getting changed largefiles
1254 1250 3 largefiles updated, 0 removed
1255 1251 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1256 1252 # Delete the largefiles in the largefiles system cache so that we have an
1257 1253 # opportunity to test that caching after a pull works.
1258 1254 $ rm "${USERCACHE}"/*
1259 1255 $ cd f
1260 1256 $ echo "large4-merge-test" > sub/large4
1261 1257 $ hg commit -m "Modify large4 to test merge"
1262 1258 Invoking status precommit hook
1263 1259 M sub/large4
1264 1260 $ hg pull ../e
1265 1261 pulling from ../e
1266 1262 searching for changes
1267 1263 adding changesets
1268 1264 adding manifests
1269 1265 adding file changes
1270 1266 added 2 changesets with 4 changes to 4 files (+1 heads)
1271 1267 (run 'hg heads' to see heads, 'hg merge' to merge)
1272 1268 caching new largefiles
1273 1269 2 largefiles cached
1274 1270 $ hg merge
1275 1271 merging sub/large4
1276 1272 largefile sub/large4 has a merge conflict
1277 1273 keep (l)ocal or take (o)ther? l
1278 1274 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1279 1275 (branch merge, don't forget to commit)
1280 1276 getting changed largefiles
1281 1277 1 largefiles updated, 0 removed
1282 1278 $ hg commit -m "Merge repos e and f"
1283 1279 Invoking status precommit hook
1284 1280 M normal3
1285 1281 M sub/normal4
1286 1282 M sub2/large6
1287 1283 $ cat normal3
1288 1284 normal3-modified
1289 1285 $ cat sub/normal4
1290 1286 normal4-modified
1291 1287 $ cat sub/large4
1292 1288 large4-merge-test
1293 1289 $ cat sub2/large6
1294 1290 large6-modified
1295 1291 $ cat sub2/large7
1296 1292 large7
1297 1293
1298 1294 Test status after merging with a branch that introduces a new largefile:
1299 1295
1300 1296 $ echo large > large
1301 1297 $ hg add --large large
1302 1298 $ hg commit -m 'add largefile'
1303 1299 Invoking status precommit hook
1304 1300 A large
1305 1301 $ hg update -q ".^"
1306 1302 $ echo change >> normal3
1307 1303 $ hg commit -m 'some change'
1308 1304 Invoking status precommit hook
1309 1305 M normal3
1310 1306 created new head
1311 1307 $ hg merge
1312 1308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1313 1309 (branch merge, don't forget to commit)
1314 1310 getting changed largefiles
1315 1311 1 largefiles updated, 0 removed
1316 1312 $ hg status
1317 1313 M large
1318 1314
1319 1315 - make sure update of merge with removed largefiles fails as expected
1320 1316 $ hg rm sub2/large6
1321 1317 $ hg up -r.
1322 1318 abort: outstanding uncommitted merges
1323 1319 [255]
1324 1320
1325 1321 - revert should be able to revert files introduced in a pending merge
1326 1322 $ hg revert --all -r .
1327 1323 removing .hglf/large (glob)
1328 1324 undeleting .hglf/sub2/large6 (glob)
1329 1325
1330 1326 Test that a normal file and a largefile with the same name and path cannot
1331 1327 coexist.
1332 1328
1333 1329 $ rm sub2/large7
1334 1330 $ echo "largeasnormal" > sub2/large7
1335 1331 $ hg add sub2/large7
1336 1332 sub2/large7 already a largefile
1337 1333
1338 1334 Test that transplanting a largefile change works correctly.
1339 1335
1340 1336 $ cd ..
1341 1337 $ hg clone -r 8 d g
1342 1338 adding changesets
1343 1339 adding manifests
1344 1340 adding file changes
1345 1341 added 9 changesets with 26 changes to 10 files
1346 1342 updating to branch default
1347 1343 getting changed largefiles
1348 1344 3 largefiles updated, 0 removed
1349 1345 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1350 1346 $ cd g
1351 1347 $ hg transplant -s ../d 598410d3eb9a
1352 1348 searching for changes
1353 1349 searching for changes
1354 1350 adding changesets
1355 1351 adding manifests
1356 1352 adding file changes
1357 1353 added 1 changesets with 2 changes to 2 files
1358 1354 getting changed largefiles
1359 1355 1 largefiles updated, 0 removed
1360 1356 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1361 1357 9:598410d3eb9a modify normal file largefile in repo d
1362 1358 8:a381d2c8c80e modify normal file and largefile in repo b
1363 1359 7:daea875e9014 add/edit more largefiles
1364 1360 6:4355d653f84f edit files yet again
1365 1361 5:9d5af5072dbd edit files again
1366 1362 4:74c02385b94c move files
1367 1363 3:9e8fbc4bce62 copy files
1368 1364 2:51a0ae4d5864 remove files
1369 1365 1:ce8896473775 edit files
1370 1366 0:30d30fe6a5be add files
1371 1367 $ cat normal3
1372 1368 normal3-modified
1373 1369 $ cat sub/normal4
1374 1370 normal4-modified
1375 1371 $ cat sub/large4
1376 1372 large4-modified
1377 1373 $ cat sub2/large6
1378 1374 large6-modified
1379 1375 $ cat sub2/large7
1380 1376 large7
1381 1377
1382 1378 Cat a largefile
1383 1379 $ hg cat normal3
1384 1380 normal3-modified
1385 1381 $ hg cat sub/large4
1386 1382 large4-modified
1387 1383 $ rm "${USERCACHE}"/*
1388 1384 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1389 1385 $ cat cat.out
1390 1386 large4-modified
1391 1387 $ rm cat.out
1392 1388 $ hg cat -r a381d2c8c80e normal3
1393 1389 normal3-modified
1394 1390 $ hg cat -r '.^' normal3
1395 1391 normal3-modified
1396 1392 $ hg cat -r '.^' sub/large4 doesntexist
1397 1393 large4-modified
1398 1394 doesntexist: no such file in rev a381d2c8c80e
1399 1395 [1]
1400 1396
1401 1397 Test that renaming a largefile results in correct output for status
1402 1398
1403 1399 $ hg rename sub/large4 large4-renamed
1404 1400 $ hg commit -m "test rename output"
1405 1401 Invoking status precommit hook
1406 1402 A large4-renamed
1407 1403 R sub/large4
1408 1404 $ cat large4-renamed
1409 1405 large4-modified
1410 1406 $ cd sub2
1411 1407 $ hg rename large6 large6-renamed
1412 1408 $ hg st
1413 1409 A sub2/large6-renamed
1414 1410 R sub2/large6
1415 1411 $ cd ..
1416 1412
1417 1413 Test --normal flag
1418 1414
1419 1415 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1420 1416 $ hg add --normal --large new-largefile
1421 1417 abort: --normal cannot be used with --large
1422 1418 [255]
1423 1419 $ hg add --normal new-largefile
1424 1420 new-largefile: up to 69 MB of RAM may be required to manage this file
1425 1421 (use 'hg revert new-largefile' to cancel the pending addition)
1426 1422 $ cd ..
1427 1423
1428 1424 #if serve
1429 1425 vanilla clients not locked out from largefiles servers on vanilla repos
1430 1426 $ mkdir r1
1431 1427 $ cd r1
1432 1428 $ hg init
1433 1429 $ echo c1 > f1
1434 1430 $ hg add f1
1435 1431 $ hg commit -m "m1"
1436 1432 Invoking status precommit hook
1437 1433 A f1
1438 1434 $ cd ..
1439 1435 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1440 1436 $ cat hg.pid >> $DAEMON_PIDS
1441 1437 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1442 1438 requesting all changes
1443 1439 adding changesets
1444 1440 adding manifests
1445 1441 adding file changes
1446 1442 added 1 changesets with 1 changes to 1 files
1447 1443 updating to branch default
1448 1444 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1449 1445
1450 1446 largefiles clients still work with vanilla servers
1451 1447 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1452 1448 $ cat hg.pid >> $DAEMON_PIDS
1453 1449 $ hg clone http://localhost:$HGPORT1 r3
1454 1450 requesting all changes
1455 1451 adding changesets
1456 1452 adding manifests
1457 1453 adding file changes
1458 1454 added 1 changesets with 1 changes to 1 files
1459 1455 updating to branch default
1460 1456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1461 1457 #endif
1462 1458
1463 1459
1464 1460 vanilla clients locked out from largefiles http repos
1465 1461 $ mkdir r4
1466 1462 $ cd r4
1467 1463 $ hg init
1468 1464 $ echo c1 > f1
1469 1465 $ hg add --large f1
1470 1466 $ hg commit -m "m1"
1471 1467 Invoking status precommit hook
1472 1468 A f1
1473 1469 $ cd ..
1474 1470
1475 1471 largefiles can be pushed locally (issue3583)
1476 1472 $ hg init dest
1477 1473 $ cd r4
1478 1474 $ hg outgoing ../dest
1479 1475 comparing with ../dest
1480 1476 searching for changes
1481 1477 changeset: 0:639881c12b4c
1482 1478 tag: tip
1483 1479 user: test
1484 1480 date: Thu Jan 01 00:00:00 1970 +0000
1485 1481 summary: m1
1486 1482
1487 1483 $ hg push ../dest
1488 1484 pushing to ../dest
1489 1485 searching for changes
1490 1486 searching for changes
1491 1487 adding changesets
1492 1488 adding manifests
1493 1489 adding file changes
1494 1490 added 1 changesets with 1 changes to 1 files
1495 1491
1496 1492 exit code with nothing outgoing (issue3611)
1497 1493 $ hg outgoing ../dest
1498 1494 comparing with ../dest
1499 1495 searching for changes
1500 1496 no changes found
1501 1497 [1]
1502 1498 $ cd ..
1503 1499
1504 1500 #if serve
1505 1501 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1506 1502 $ cat hg.pid >> $DAEMON_PIDS
1507 1503 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1508 1504 abort: remote error:
1509 1505
1510 1506 This repository uses the largefiles extension.
1511 1507
1512 1508 Please enable it in your Mercurial config file.
1513 1509 [255]
1514 1510
1515 1511 used all HGPORTs, kill all daemons
1516 1512 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1517 1513 #endif
1518 1514
1519 1515 vanilla clients locked out from largefiles ssh repos
1520 1516 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1521 1517 abort: remote error:
1522 1518
1523 1519 This repository uses the largefiles extension.
1524 1520
1525 1521 Please enable it in your Mercurial config file.
1526 1522 [255]
1527 1523
1528 1524 #if serve
1529 1525
1530 1526 largefiles clients refuse to push largefiles repos to vanilla servers
1531 1527 $ mkdir r6
1532 1528 $ cd r6
1533 1529 $ hg init
1534 1530 $ echo c1 > f1
1535 1531 $ hg add f1
1536 1532 $ hg commit -m "m1"
1537 1533 Invoking status precommit hook
1538 1534 A f1
1539 1535 $ cat >> .hg/hgrc <<!
1540 1536 > [web]
1541 1537 > push_ssl = false
1542 1538 > allow_push = *
1543 1539 > !
1544 1540 $ cd ..
1545 1541 $ hg clone r6 r7
1546 1542 updating to branch default
1547 1543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1548 1544 $ cd r7
1549 1545 $ echo c2 > f2
1550 1546 $ hg add --large f2
1551 1547 $ hg commit -m "m2"
1552 1548 Invoking status precommit hook
1553 1549 A f2
1554 1550 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1555 1551 $ cat ../hg.pid >> $DAEMON_PIDS
1556 1552 $ hg push http://localhost:$HGPORT
1557 1553 pushing to http://localhost:$HGPORT/
1558 1554 searching for changes
1559 1555 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1560 1556 [255]
1561 1557 $ cd ..
1562 1558
1563 1559 putlfile errors are shown (issue3123)
1564 1560 Corrupt the cached largefile in r7 and move it out of the servers usercache
1565 1561 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
1566 1562 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1567 1563 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1568 1564 $ hg init empty
1569 1565 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1570 1566 > --config 'web.allow_push=*' --config web.push_ssl=False
1571 1567 $ cat hg.pid >> $DAEMON_PIDS
1572 1568 $ hg push -R r7 http://localhost:$HGPORT1
1573 1569 pushing to http://localhost:$HGPORT1/
1574 1570 searching for changes
1575 1571 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1576 1572 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1577 1573 [255]
1578 1574 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1579 1575 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
1580 1576 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1581 1577 $ hg push -R r7 http://localhost:$HGPORT1
1582 1578 pushing to http://localhost:$HGPORT1/
1583 1579 searching for changes
1584 1580 searching for changes
1585 1581 remote: adding changesets
1586 1582 remote: adding manifests
1587 1583 remote: adding file changes
1588 1584 remote: added 2 changesets with 2 changes to 2 files
1589 1585 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1590 1586 server side corruption
1591 1587 $ rm -rf empty
1592 1588
1593 1589 Push a largefiles repository to a served empty repository
1594 1590 $ hg init r8
1595 1591 $ echo c3 > r8/f1
1596 1592 $ hg add --large r8/f1 -R r8
1597 1593 $ hg commit -m "m1" -R r8
1598 1594 Invoking status precommit hook
1599 1595 A f1
1600 1596 $ hg init empty
1601 1597 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1602 1598 > --config 'web.allow_push=*' --config web.push_ssl=False
1603 1599 $ cat hg.pid >> $DAEMON_PIDS
1604 1600 $ rm "${USERCACHE}"/*
1605 1601 $ hg push -R r8 http://localhost:$HGPORT2/#default
1606 1602 pushing to http://localhost:$HGPORT2/
1607 1603 searching for changes
1608 1604 searching for changes
1609 1605 remote: adding changesets
1610 1606 remote: adding manifests
1611 1607 remote: adding file changes
1612 1608 remote: added 1 changesets with 1 changes to 1 files
1613 1609 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1614 1610 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1615 1611
1616 1612 Clone over http, no largefiles pulled on clone.
1617 1613
1618 1614 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
1619 1615 adding changesets
1620 1616 adding manifests
1621 1617 adding file changes
1622 1618 added 1 changesets with 1 changes to 1 files
1623 1619
1624 1620 test 'verify' with remotestore:
1625 1621
1626 1622 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
1627 1623 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1628 1624 $ hg -R http-clone verify --large --lfa
1629 1625 checking changesets
1630 1626 checking manifests
1631 1627 crosschecking files in changesets and manifests
1632 1628 checking files
1633 1629 1 files, 1 changesets, 1 total revisions
1634 1630 searching 1 changesets for largefiles
1635 1631 changeset 0:cf03e5bb9936: f1 missing
1636 1632 verified existence of 1 revisions of 1 largefiles
1637 1633 [1]
1638 1634 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1639 1635 $ hg -R http-clone -q verify --large --lfa
1640 searching 1 changesets for largefiles
1641 verified existence of 1 revisions of 1 largefiles
1642 1636
1643 1637 largefiles pulled on update - a largefile missing on the server:
1644 1638 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1645 1639 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1646 1640 getting changed largefiles
1647 1641 abort: remotestore: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 is missing
1648 1642 [255]
1649 1643 $ hg -R http-clone up -Cqr null
1650 1644
1651 1645 largefiles pulled on update - a largefile corrupted on the server:
1652 1646 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1653 1647 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1654 1648 getting changed largefiles
1655 1649 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1656 1650 0 largefiles updated, 0 removed
1657 1651 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1658 1652 $ hg -R http-clone st
1659 1653 ! f1
1660 1654 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1661 1655 $ [ ! -f http-clone/f1 ]
1662 1656 $ [ ! -f http-clone-usercache ]
1663 1657 $ hg -R http-clone verify --large --lfc
1664 1658 checking changesets
1665 1659 checking manifests
1666 1660 crosschecking files in changesets and manifests
1667 1661 checking files
1668 1662 1 files, 1 changesets, 1 total revisions
1669 1663 searching 1 changesets for largefiles
1670 1664 verified contents of 1 revisions of 1 largefiles
1671 1665 $ hg -R http-clone up -Cqr null
1672 1666
1673 1667 largefiles pulled on update - no server side problems:
1674 1668 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
1675 1669 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
1676 1670 resolving manifests
1677 1671 overwrite: False, partial: False
1678 1672 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
1679 1673 .hglf/f1: remote created -> g
1680 1674 updating: .hglf/f1 1/1 files (100.00%)
1681 1675 getting .hglf/f1
1682 1676 getting changed largefiles
1683 1677 using http://localhost:$HGPORT2/
1684 1678 sending capabilities command
1685 1679 getting largefiles: 0/1 lfile (0.00%)
1686 1680 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
1687 1681 sending batch command
1688 1682 sending getlfile command
1689 1683 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
1690 1684 1 largefiles updated, 0 removed
1691 1685 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1692 1686
1693 1687 $ ls http-clone-usercache/*
1694 1688 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
1695 1689
1696 1690 $ rm -rf empty http-clone*
1697 1691
1698 1692 used all HGPORTs, kill all daemons
1699 1693 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1700 1694
1701 1695 #endif
1702 1696
1703 1697
1704 1698 #if unix-permissions
1705 1699
1706 1700 Clone a local repository owned by another user
1707 1701 We have to simulate that here by setting $HOME and removing write permissions
1708 1702 $ ORIGHOME="$HOME"
1709 1703 $ mkdir alice
1710 1704 $ HOME="`pwd`/alice"
1711 1705 $ cd alice
1712 1706 $ hg init pubrepo
1713 1707 $ cd pubrepo
1714 1708 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1715 1709 $ hg add --large a-large-file
1716 1710 $ hg commit -m "Add a large file"
1717 1711 Invoking status precommit hook
1718 1712 A a-large-file
1719 1713 $ cd ..
1720 1714 $ chmod -R a-w pubrepo
1721 1715 $ cd ..
1722 1716 $ mkdir bob
1723 1717 $ HOME="`pwd`/bob"
1724 1718 $ cd bob
1725 1719 $ hg clone --pull ../alice/pubrepo pubrepo
1726 1720 requesting all changes
1727 1721 adding changesets
1728 1722 adding manifests
1729 1723 adding file changes
1730 1724 added 1 changesets with 1 changes to 1 files
1731 1725 updating to branch default
1732 1726 getting changed largefiles
1733 1727 1 largefiles updated, 0 removed
1734 1728 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1735 1729 $ cd ..
1736 1730 $ chmod -R u+w alice/pubrepo
1737 1731 $ HOME="$ORIGHOME"
1738 1732
1739 1733 #endif
1740 1734
1741 1735 #if symlink
1742 1736
1743 1737 Symlink to a large largefile should behave the same as a symlink to a normal file
1744 1738 $ hg init largesymlink
1745 1739 $ cd largesymlink
1746 1740 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1747 1741 $ hg add --large largefile
1748 1742 $ hg commit -m "commit a large file"
1749 1743 Invoking status precommit hook
1750 1744 A largefile
1751 1745 $ ln -s largefile largelink
1752 1746 $ hg add largelink
1753 1747 $ hg commit -m "commit a large symlink"
1754 1748 Invoking status precommit hook
1755 1749 A largelink
1756 1750 $ rm -f largelink
1757 1751 $ hg up >/dev/null
1758 1752 $ test -f largelink
1759 1753 [1]
1760 1754 $ test -L largelink
1761 1755 [1]
1762 1756 $ rm -f largelink # make next part of the test independent of the previous
1763 1757 $ hg up -C >/dev/null
1764 1758 $ test -f largelink
1765 1759 $ test -L largelink
1766 1760 $ cd ..
1767 1761
1768 1762 #endif
1769 1763
1770 1764 test for pattern matching on 'hg status':
1771 1765 to boost performance, largefiles checks whether specified patterns are
1772 1766 related to largefiles in working directory (NOT to STANDIN) or not.
1773 1767
1774 1768 $ hg init statusmatch
1775 1769 $ cd statusmatch
1776 1770
1777 1771 $ mkdir -p a/b/c/d
1778 1772 $ echo normal > a/b/c/d/e.normal.txt
1779 1773 $ hg add a/b/c/d/e.normal.txt
1780 1774 $ echo large > a/b/c/d/e.large.txt
1781 1775 $ hg add --large a/b/c/d/e.large.txt
1782 1776 $ mkdir -p a/b/c/x
1783 1777 $ echo normal > a/b/c/x/y.normal.txt
1784 1778 $ hg add a/b/c/x/y.normal.txt
1785 1779 $ hg commit -m 'add files'
1786 1780 Invoking status precommit hook
1787 1781 A a/b/c/d/e.large.txt
1788 1782 A a/b/c/d/e.normal.txt
1789 1783 A a/b/c/x/y.normal.txt
1790 1784
1791 1785 (1) no pattern: no performance boost
1792 1786 $ hg status -A
1793 1787 C a/b/c/d/e.large.txt
1794 1788 C a/b/c/d/e.normal.txt
1795 1789 C a/b/c/x/y.normal.txt
1796 1790
1797 1791 (2) pattern not related to largefiles: performance boost
1798 1792 $ hg status -A a/b/c/x
1799 1793 C a/b/c/x/y.normal.txt
1800 1794
1801 1795 (3) pattern related to largefiles: no performance boost
1802 1796 $ hg status -A a/b/c/d
1803 1797 C a/b/c/d/e.large.txt
1804 1798 C a/b/c/d/e.normal.txt
1805 1799
1806 1800 (4) pattern related to STANDIN (not to largefiles): performance boost
1807 1801 $ hg status -A .hglf/a
1808 1802 C .hglf/a/b/c/d/e.large.txt
1809 1803
1810 1804 (5) mixed case: no performance boost
1811 1805 $ hg status -A a/b/c/x a/b/c/d
1812 1806 C a/b/c/d/e.large.txt
1813 1807 C a/b/c/d/e.normal.txt
1814 1808 C a/b/c/x/y.normal.txt
1815 1809
1816 1810 verify that largefiles doesn't break filesets
1817 1811
1818 1812 $ hg log --rev . --exclude "set:binary()"
1819 1813 changeset: 0:41bd42f10efa
1820 1814 tag: tip
1821 1815 user: test
1822 1816 date: Thu Jan 01 00:00:00 1970 +0000
1823 1817 summary: add files
1824 1818
1825 1819 verify that large files in subrepos handled properly
1826 1820 $ hg init subrepo
1827 1821 $ echo "subrepo = subrepo" > .hgsub
1828 1822 $ hg add .hgsub
1829 1823 $ hg ci -m "add subrepo"
1830 1824 Invoking status precommit hook
1831 1825 A .hgsub
1832 1826 ? .hgsubstate
1833 1827 $ echo "rev 1" > subrepo/large.txt
1834 1828 $ hg -R subrepo add --large subrepo/large.txt
1835 1829 $ hg sum
1836 1830 parent: 1:8ee150ea2e9c tip
1837 1831 add subrepo
1838 1832 branch: default
1839 1833 commit: 1 subrepos
1840 1834 update: (current)
1841 1835 $ hg st
1842 1836 $ hg st -S
1843 1837 A subrepo/large.txt
1844 1838 $ hg ci -S -m "commit top repo"
1845 1839 committing subrepository subrepo
1846 1840 Invoking status precommit hook
1847 1841 A large.txt
1848 1842 Invoking status precommit hook
1849 1843 M .hgsubstate
1850 1844 # No differences
1851 1845 $ hg st -S
1852 1846 $ hg sum
1853 1847 parent: 2:ce4cd0c527a6 tip
1854 1848 commit top repo
1855 1849 branch: default
1856 1850 commit: (clean)
1857 1851 update: (current)
1858 1852 $ echo "rev 2" > subrepo/large.txt
1859 1853 $ hg st -S
1860 1854 M subrepo/large.txt
1861 1855 $ hg sum
1862 1856 parent: 2:ce4cd0c527a6 tip
1863 1857 commit top repo
1864 1858 branch: default
1865 1859 commit: 1 subrepos
1866 1860 update: (current)
1867 1861 $ hg ci -m "this commit should fail without -S"
1868 1862 abort: uncommitted changes in subrepo subrepo
1869 1863 (use --subrepos for recursive commit)
1870 1864 [255]
1871 1865
1872 1866 Add a normal file to the subrepo, then test archiving
1873 1867
1874 1868 $ echo 'normal file' > subrepo/normal.txt
1875 1869 $ hg -R subrepo add subrepo/normal.txt
1876 1870
1877 1871 Lock in subrepo, otherwise the change isn't archived
1878 1872
1879 1873 $ hg ci -S -m "add normal file to top level"
1880 1874 committing subrepository subrepo
1881 1875 Invoking status precommit hook
1882 1876 M large.txt
1883 1877 A normal.txt
1884 1878 Invoking status precommit hook
1885 1879 M .hgsubstate
1886 1880 $ hg archive -S ../lf_subrepo_archive
1887 1881 $ find ../lf_subrepo_archive | sort
1888 1882 ../lf_subrepo_archive
1889 1883 ../lf_subrepo_archive/.hg_archival.txt
1890 1884 ../lf_subrepo_archive/.hgsub
1891 1885 ../lf_subrepo_archive/.hgsubstate
1892 1886 ../lf_subrepo_archive/a
1893 1887 ../lf_subrepo_archive/a/b
1894 1888 ../lf_subrepo_archive/a/b/c
1895 1889 ../lf_subrepo_archive/a/b/c/d
1896 1890 ../lf_subrepo_archive/a/b/c/d/e.large.txt
1897 1891 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
1898 1892 ../lf_subrepo_archive/a/b/c/x
1899 1893 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
1900 1894 ../lf_subrepo_archive/subrepo
1901 1895 ../lf_subrepo_archive/subrepo/large.txt
1902 1896 ../lf_subrepo_archive/subrepo/normal.txt
1903 1897
1904 1898 Test update with subrepos.
1905 1899
1906 1900 $ hg update 0
1907 1901 getting changed largefiles
1908 1902 0 largefiles updated, 1 removed
1909 1903 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1910 1904 $ hg status -S
1911 1905 $ hg update tip
1912 1906 getting changed largefiles
1913 1907 1 largefiles updated, 0 removed
1914 1908 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1915 1909 $ hg status -S
1916 1910 # modify a large file
1917 1911 $ echo "modified" > subrepo/large.txt
1918 1912 $ hg st -S
1919 1913 M subrepo/large.txt
1920 1914 # update -C should revert the change.
1921 1915 $ hg update -C
1922 1916 getting changed largefiles
1923 1917 1 largefiles updated, 0 removed
1924 1918 getting changed largefiles
1925 1919 0 largefiles updated, 0 removed
1926 1920 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1927 1921 $ hg status -S
1928 1922
1929 1923 Test archiving a revision that references a subrepo that is not yet
1930 1924 cloned (see test-subrepo-recursion.t):
1931 1925
1932 1926 $ hg clone -U . ../empty
1933 1927 $ cd ../empty
1934 1928 $ hg archive --subrepos -r tip ../archive.tar.gz
1935 1929 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
1936 1930 $ cd ..
1937 1931
1938 1932 Test that addremove picks up largefiles prior to the initial commit (issue3541)
1939 1933
1940 1934 $ hg init addrm2
1941 1935 $ cd addrm2
1942 1936 $ touch large.dat
1943 1937 $ touch large2.dat
1944 1938 $ touch normal
1945 1939 $ hg add --large large.dat
1946 1940 $ hg addremove -v
1947 1941 adding large2.dat as a largefile
1948 1942 adding normal
1949 1943
1950 1944 Test that forgetting all largefiles reverts to islfilesrepo() == False
1951 1945 (addremove will add *.dat as normal files now)
1952 1946 $ hg forget large.dat
1953 1947 $ hg forget large2.dat
1954 1948 $ hg addremove -v
1955 1949 adding large.dat
1956 1950 adding large2.dat
1957 1951
1958 1952 Test commit's addremove option prior to the first commit
1959 1953 $ hg forget large.dat
1960 1954 $ hg forget large2.dat
1961 1955 $ hg add --large large.dat
1962 1956 $ hg ci -Am "commit"
1963 1957 adding large2.dat as a largefile
1964 1958 Invoking status precommit hook
1965 1959 A large.dat
1966 1960 A large2.dat
1967 1961 A normal
1968 1962 $ find .hglf | sort
1969 1963 .hglf
1970 1964 .hglf/large.dat
1971 1965 .hglf/large2.dat
1972 1966
1973 1967 Test actions on largefiles using relative paths from subdir
1974 1968
1975 1969 $ mkdir sub
1976 1970 $ cd sub
1977 1971 $ echo anotherlarge > anotherlarge
1978 1972 $ hg add --large anotherlarge
1979 1973 $ hg st
1980 1974 A sub/anotherlarge
1981 1975 $ hg st anotherlarge
1982 1976 A anotherlarge
1983 1977 $ hg commit -m anotherlarge anotherlarge
1984 1978 Invoking status precommit hook
1985 1979 A sub/anotherlarge
1986 1980 $ hg log anotherlarge
1987 1981 changeset: 1:9627a577c5e9
1988 1982 tag: tip
1989 1983 user: test
1990 1984 date: Thu Jan 01 00:00:00 1970 +0000
1991 1985 summary: anotherlarge
1992 1986
1993 1987 $ echo more >> anotherlarge
1994 1988 $ hg st .
1995 1989 M anotherlarge
1996 1990 $ hg cat anotherlarge
1997 1991 anotherlarge
1998 1992 $ hg revert anotherlarge
1999 1993 $ hg st
2000 1994 ? sub/anotherlarge.orig
2001 1995 $ cd ..
2002 1996
2003 1997 $ cd ..
2004 1998
2005 1999 issue3651: summary/outgoing with largefiles shows "no remote repo"
2006 2000 unexpectedly
2007 2001
2008 2002 $ mkdir issue3651
2009 2003 $ cd issue3651
2010 2004
2011 2005 $ hg init src
2012 2006 $ echo a > src/a
2013 2007 $ hg -R src add --large src/a
2014 2008 $ hg -R src commit -m '#0'
2015 2009 Invoking status precommit hook
2016 2010 A a
2017 2011
2018 2012 check messages when no remote repository is specified:
2019 2013 "no remote repo" route for "hg outgoing --large" is not tested here,
2020 2014 because it can't be reproduced easily.
2021 2015
2022 2016 $ hg init clone1
2023 2017 $ hg -R clone1 -q pull src
2024 2018 $ hg -R clone1 -q update
2025 2019 $ hg -R clone1 paths | grep default
2026 2020 [1]
2027 2021
2028 2022 $ hg -R clone1 summary --large
2029 2023 parent: 0:fc0bd45326d3 tip
2030 2024 #0
2031 2025 branch: default
2032 2026 commit: (clean)
2033 2027 update: (current)
2034 2028 largefiles: (no remote repo)
2035 2029
2036 2030 check messages when there is no files to upload:
2037 2031
2038 2032 $ hg -q clone src clone2
2039 2033 $ hg -R clone2 paths | grep default
2040 2034 default = $TESTTMP/issue3651/src (glob)
2041 2035
2042 2036 $ hg -R clone2 summary --large
2043 2037 parent: 0:fc0bd45326d3 tip
2044 2038 #0
2045 2039 branch: default
2046 2040 commit: (clean)
2047 2041 update: (current)
2048 2042 searching for changes
2049 2043 largefiles: (no files to upload)
2050 2044 $ hg -R clone2 outgoing --large
2051 2045 comparing with $TESTTMP/issue3651/src (glob)
2052 2046 searching for changes
2053 2047 no changes found
2054 2048 searching for changes
2055 2049 largefiles: no files to upload
2056 2050 [1]
2057 2051
2058 2052 check messages when there are files to upload:
2059 2053
2060 2054 $ echo b > clone2/b
2061 2055 $ hg -R clone2 add --large clone2/b
2062 2056 $ hg -R clone2 commit -m '#1'
2063 2057 Invoking status precommit hook
2064 2058 A b
2065 2059 $ hg -R clone2 summary --large
2066 2060 parent: 1:1acbe71ce432 tip
2067 2061 #1
2068 2062 branch: default
2069 2063 commit: (clean)
2070 2064 update: (current)
2071 2065 searching for changes
2072 2066 largefiles: 1 to upload
2073 2067 $ hg -R clone2 outgoing --large
2074 2068 comparing with $TESTTMP/issue3651/src (glob)
2075 2069 searching for changes
2076 2070 changeset: 1:1acbe71ce432
2077 2071 tag: tip
2078 2072 user: test
2079 2073 date: Thu Jan 01 00:00:00 1970 +0000
2080 2074 summary: #1
2081 2075
2082 2076 searching for changes
2083 2077 largefiles to upload:
2084 2078 b
2085 2079
2086 2080
2087 2081 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now