Show More
@@ -257,25 +257,28 b' def _reposetup(ui, repo):' | |||||
257 | if b'lfs' not in repo.requirements: |
|
257 | if b'lfs' not in repo.requirements: | |
258 |
|
258 | |||
259 | def checkrequireslfs(ui, repo, **kwargs): |
|
259 | def checkrequireslfs(ui, repo, **kwargs): | |
260 | if b'lfs' in repo.requirements: |
|
260 | with repo.lock(): | |
261 | return 0 |
|
261 | if b'lfs' in repo.requirements: | |
|
262 | return 0 | |||
262 |
|
263 | |||
263 | last = kwargs.get('node_last') |
|
264 | last = kwargs.get('node_last') | |
264 | if last: |
|
265 | if last: | |
265 | s = repo.set(b'%n:%n', bin(kwargs['node']), bin(last)) |
|
266 | s = repo.set(b'%n:%n', bin(kwargs['node']), bin(last)) | |
266 | else: |
|
267 | else: | |
267 | s = repo.set(b'%n', bin(kwargs['node'])) |
|
268 | s = repo.set(b'%n', bin(kwargs['node'])) | |
268 | match = repo._storenarrowmatch |
|
269 | match = repo._storenarrowmatch | |
269 | for ctx in s: |
|
270 | for ctx in s: | |
270 | # TODO: is there a way to just walk the files in the commit? |
|
271 | # TODO: is there a way to just walk the files in the commit? | |
271 | if any( |
|
272 | if any( | |
272 | ctx[f].islfs() for f in ctx.files() if f in ctx and match(f) |
|
273 | ctx[f].islfs() | |
273 | ): |
|
274 | for f in ctx.files() | |
274 | repo.requirements.add(b'lfs') |
|
275 | if f in ctx and match(f) | |
275 | repo.features.add(repository.REPO_FEATURE_LFS) |
|
276 | ): | |
276 |
|
|
277 | repo.requirements.add(b'lfs') | |
277 | repo.prepushoutgoinghooks.add(b'lfs', wrapper.prepush) |
|
278 | repo.features.add(repository.REPO_FEATURE_LFS) | |
278 | break |
|
279 | scmutil.writereporequirements(repo) | |
|
280 | repo.prepushoutgoinghooks.add(b'lfs', wrapper.prepush) | |||
|
281 | break | |||
279 |
|
282 | |||
280 | ui.setconfig(b'hooks', b'commit.lfs', checkrequireslfs, b'lfs') |
|
283 | ui.setconfig(b'hooks', b'commit.lfs', checkrequireslfs, b'lfs') | |
281 | ui.setconfig( |
|
284 | ui.setconfig( |
General Comments 0
You need to be logged in to leave comments.
Login now