Mercurial > hg
comparison hgext/lfs/wrapper.py @ 45072:a56ba57c837d
scmutil: allowing different files to be prefetched per revision
The old API takes a list of revision separate from the file matcher, and thus
provides no way to fetch different sets of files from each revision. In
preparation for adding one such usage, I'm changing the API to take a list of
(revision, file matcher) tuples instead.
Differential Revision: https://phab.mercurial-scm.org/D8721
author | Rodrigo Damazio Bovendorp <rdamazio@google.com> |
---|---|
date | Thu, 09 Jul 2020 18:48:55 -0700 |
parents | b9e174d4ed11 |
children | a03c177a4679 |
comparison
equal
deleted
inserted
replaced
45071:196ba4d4eb86 | 45072:a56ba57c837d |
---|---|
335 for name in [b'lfslocalblobstore', b'lfsremoteblobstore']: | 335 for name in [b'lfslocalblobstore', b'lfsremoteblobstore']: |
336 if util.safehasattr(othervfs, name): | 336 if util.safehasattr(othervfs, name): |
337 setattr(self, name, getattr(othervfs, name)) | 337 setattr(self, name, getattr(othervfs, name)) |
338 | 338 |
339 | 339 |
340 def _prefetchfiles(repo, revs, match): | 340 def _prefetchfiles(repo, revmatches): |
341 """Ensure that required LFS blobs are present, fetching them as a group if | 341 """Ensure that required LFS blobs are present, fetching them as a group if |
342 needed.""" | 342 needed.""" |
343 if not util.safehasattr(repo.svfs, b'lfslocalblobstore'): | 343 if not util.safehasattr(repo.svfs, b'lfslocalblobstore'): |
344 return | 344 return |
345 | 345 |
346 pointers = [] | 346 pointers = [] |
347 oids = set() | 347 oids = set() |
348 localstore = repo.svfs.lfslocalblobstore | 348 localstore = repo.svfs.lfslocalblobstore |
349 | 349 |
350 for rev in revs: | 350 for rev, match in revmatches: |
351 ctx = repo[rev] | 351 ctx = repo[rev] |
352 for f in ctx.walk(match): | 352 for f in ctx.walk(match): |
353 p = pointerfromctx(ctx, f) | 353 p = pointerfromctx(ctx, f) |
354 if p and p.oid() not in oids and not localstore.has(p.oid()): | 354 if p and p.oid() not in oids and not localstore.has(p.oid()): |
355 p.filename = f | 355 p.filename = f |