comparison hgext/lfs/__init__.py @ 37138:4d63f3bc1e1a

lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794) There's a similar test in lfs.wrapper.convertsink(), but I didn't update that because I don't think that the sink repo in a convert can be narrow. It seems reasonable that a narrow clone of an LFS repo may not necessarily be an LFS repo. The only potential issue is that LFS has a hard requirement for changegroup v3, which that extension enables. The use of treemanifest will enable changegroup v3 in narrow clones, because allsupportedversions() in changegroup.py preserves it when it sees a 'treemanifest' requirement. But I don't see where changegroup v3 is enabled for a flat manifest.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 26 Mar 2018 22:18:36 -0400
parents ecac0006b90e
children a2566597acb5
comparison
equal deleted inserted replaced
37137:db90a5793103 37138:4d63f3bc1e1a
224 _bin = node.bin 224 _bin = node.bin
225 if last: 225 if last:
226 s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) 226 s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last))
227 else: 227 else:
228 s = repo.set('%n', _bin(kwargs[r'node'])) 228 s = repo.set('%n', _bin(kwargs[r'node']))
229 match = repo.narrowmatch()
229 for ctx in s: 230 for ctx in s:
230 # TODO: is there a way to just walk the files in the commit? 231 # TODO: is there a way to just walk the files in the commit?
231 if any(ctx[f].islfs() for f in ctx.files() if f in ctx): 232 if any(ctx[f].islfs() for f in ctx.files()
233 if f in ctx and match(f)):
232 repo.requirements.add('lfs') 234 repo.requirements.add('lfs')
233 repo._writerequirements() 235 repo._writerequirements()
234 repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) 236 repo.prepushoutgoinghooks.add('lfs', wrapper.prepush)
235 break 237 break
236 238