comparison hgext/largefiles/lfcommands.py @ 29305:814076f4ace3

largefiles: move basestore._openstore into new module to remove cycle
author liscju <piotr.listkiewicz@gmail.com>
date Sat, 04 Jun 2016 16:53:44 +0200
parents 30863ca01c6b
children 8c378a7d2aa6
comparison
equal deleted inserted replaced
29304:5e32852fa4bd 29305:814076f4ace3
18 18
19 from hgext.convert import convcmd 19 from hgext.convert import convcmd
20 from hgext.convert import filemap 20 from hgext.convert import filemap
21 21
22 import lfutil 22 import lfutil
23 import basestore 23 import storefactory
24 24
25 # -- Commands ---------------------------------------------------------- 25 # -- Commands ----------------------------------------------------------
26 26
27 cmdtable = {} 27 cmdtable = {}
28 command = cmdutil.command(cmdtable) 28 command = cmdutil.command(cmdtable)
335 '''upload largefiles to the central store''' 335 '''upload largefiles to the central store'''
336 336
337 if not files: 337 if not files:
338 return 338 return
339 339
340 store = basestore._openstore(rsrc, rdst, put=True) 340 store = storefactory._openstore(rsrc, rdst, put=True)
341 341
342 at = 0 342 at = 0
343 ui.debug("sending statlfile command for %d largefiles\n" % len(files)) 343 ui.debug("sending statlfile command for %d largefiles\n" % len(files))
344 retval = store.exists(files) 344 retval = store.exists(files)
345 files = filter(lambda h: not retval[h], files) 345 files = filter(lambda h: not retval[h], files)
366 if all: 366 if all:
367 revs = repo.revs('all()') 367 revs = repo.revs('all()')
368 else: 368 else:
369 revs = ['.'] 369 revs = ['.']
370 370
371 store = basestore._openstore(repo) 371 store = storefactory._openstore(repo)
372 return store.verify(revs, contents=contents) 372 return store.verify(revs, contents=contents)
373 373
374 def cachelfiles(ui, repo, node, filelist=None): 374 def cachelfiles(ui, repo, node, filelist=None):
375 '''cachelfiles ensures that all largefiles needed by the specified revision 375 '''cachelfiles ensures that all largefiles needed by the specified revision
376 are present in the repository's largefile cache. 376 are present in the repository's largefile cache.
392 raise 392 raise
393 if not lfutil.findfile(repo, expectedhash): 393 if not lfutil.findfile(repo, expectedhash):
394 toget.append((lfile, expectedhash)) 394 toget.append((lfile, expectedhash))
395 395
396 if toget: 396 if toget:
397 store = basestore._openstore(repo) 397 store = storefactory._openstore(repo)
398 ret = store.get(toget) 398 ret = store.get(toget)
399 return ret 399 return ret
400 400
401 return ([], []) 401 return ([], [])
402 402