##// END OF EJS Templates
largefiles: stat all largefiles in one batch before downloading...
Mads Kiilerich -
r19008:9d33d6e0 default
parent child Browse files
Show More
@@ -62,12 +62,19 b' class basestore(object):'
62 62 util.makedirs(lfutil.storepath(self.repo, ''))
63 63
64 64 at = 0
65 available = self.exists(set(hash for (_filename, hash) in files))
65 66 for filename, hash in files:
66 67 ui.progress(_('getting largefiles'), at, unit='lfile',
67 68 total=len(files))
68 69 at += 1
69 70 ui.note(_('getting %s:%s\n') % (filename, hash))
70 71
72 if not available.get(hash):
73 ui.warn(_('%s: largefile %s not available from %s\n')
74 % (filename, hash, self.url))
75 missing.append(filename)
76 continue
77
71 78 storefilename = lfutil.storepath(self.repo, hash)
72 79 tmpfile = util.atomictempfile(storefilename + '.tmp',
73 80 createmode=self.repo.store.createmode)
@@ -47,16 +47,6 b' class remotestore(basestore.basestore):'
47 47 fd.close()
48 48
49 49 def _getfile(self, tmpfile, filename, hash):
50 # quit if the largefile isn't there
51 stat = self._stat([hash])[hash]
52 if stat == 1:
53 raise util.Abort(_('remotestore: largefile %s is invalid') % hash)
54 elif stat == 2:
55 raise util.Abort(_('remotestore: largefile %s is missing') % hash)
56 elif stat != 0:
57 raise RuntimeError('error getting file: unexpected response from '
58 'statlfile (%r)' % stat)
59
60 50 try:
61 51 chunks = self._get(hash)
62 52 except urllib2.HTTPError, e:
@@ -26,8 +26,9 b' class wirestore(remotestore.remotestore)'
26 26 return self.remote.getlfile(hash)
27 27
28 28 def _stat(self, hashes):
29 '''For each hash, return 2 if the largefile is missing, 1 if it has a
30 mismatched checksum, or 0 if it is in good condition'''
29 '''For each hash, return 0 if it is available, other values if not.
30 It is usually 2 if the largefile is missing, but might be 1 the server
31 has a corrupted copy.'''
31 32 batch = self.remote.batch()
32 33 futures = {}
33 34 for hash in hashes:
@@ -47,7 +47,7 b' but there is no cache file for it. So, '
47 47
48 48 $ hg update -r0
49 49 getting changed largefiles
50 error getting id 7f7097b041ccf68cc5561e9600da4655d21c6d18 from url file:$TESTTMP/mirror for file large: can't get file locally (glob)
50 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:$TESTTMP/mirror
51 51 0 largefiles updated, 0 removed
52 52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 53 $ hg status
@@ -64,7 +64,7 b' Update working directory to tip, again.'
64 64
65 65 $ hg update -r0
66 66 getting changed largefiles
67 error getting id 7f7097b041ccf68cc5561e9600da4655d21c6d18 from url file:$TESTTMP/mirror for file large: can't get file locally (glob)
67 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:$TESTTMP/mirror
68 68 0 largefiles updated, 0 removed
69 69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 $ hg status
@@ -1306,7 +1306,7 b' Update to revision with missing largefil'
1306 1306 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1307 1307 $ hg up -r 6
1308 1308 getting changed largefiles
1309 error getting id 7838695e10da2bb75ac1156565f40a2595fa2fa0 from url file:$TESTTMP/d for file large3: can't get file locally (glob)
1309 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1310 1310 1 largefiles updated, 2 removed
1311 1311 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1312 1312 $ rm normal3
@@ -1327,7 +1327,7 b' Update to revision with missing largefil'
1327 1327 ! normal3
1328 1328 $ hg up -Cr.
1329 1329 getting changed largefiles
1330 error getting id 7838695e10da2bb75ac1156565f40a2595fa2fa0 from url file:$TESTTMP/d for file large3: can't get file locally (glob)
1330 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1331 1331 0 largefiles updated, 0 removed
1332 1332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1333 1333 $ hg st
@@ -1349,7 +1349,7 b' Merge with revision with missing largefi'
1349 1349 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1350 1350 (branch merge, don't forget to commit)
1351 1351 getting changed largefiles
1352 error getting id 7838695e10da2bb75ac1156565f40a2595fa2fa0 from url file:$TESTTMP/d for file large3: can't get file locally (glob)
1352 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d
1353 1353 1 largefiles updated, 0 removed
1354 1354
1355 1355 $ hg rollback -q
@@ -1773,8 +1773,11 b' largefiles pulled on update - a largefil'
1773 1773 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
1774 1774 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1775 1775 getting changed largefiles
1776 abort: remotestore: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 is missing
1777 [255]
1776 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
1777 0 largefiles updated, 0 removed
1778 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1779 $ hg -R http-clone st
1780 ! f1
1778 1781 $ hg -R http-clone up -Cqr null
1779 1782
1780 1783 largefiles pulled on update - a largefile corrupted on the server:
@@ -1811,9 +1814,9 b' largefiles pulled on update - no server '
1811 1814 getting changed largefiles
1812 1815 using http://localhost:$HGPORT2/
1813 1816 sending capabilities command
1817 sending batch command
1814 1818 getting largefiles: 0/1 lfile (0.00%)
1815 1819 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
1816 sending batch command
1817 1820 sending getlfile command
1818 1821 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
1819 1822 1 largefiles updated, 0 removed
@@ -343,7 +343,7 b' Ensure the abort message is useful if a '
343 343 $ rm largefiles-repo/.hg/largefiles/*
344 344 $ hg lfconvert --to-normal issue3519 normalized3519
345 345 initializing destination normalized3519
346 error getting id 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 from url file:$TESTTMP/largefiles-repo for file large: can't get file locally (glob)
346 large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:$TESTTMP/largefiles-repo
347 347 abort: missing largefile 'large' from revision d4892ec57ce212905215fad1d9018f56b99202ad
348 348 [255]
349 349
General Comments 0
You need to be logged in to leave comments. Login now