Mercurial > hg
diff hgext/largefiles/reposetup.py @ 50488:b4a9c8f18928
store: use StoreEntry API instead of parsing filename in largefile
This is more explicit and more robust.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 May 2023 09:01:02 +0200 |
parents | 521fec115dad |
children | 862e3a13da44 |
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py Mon May 15 09:00:46 2023 +0200 +++ b/hgext/largefiles/reposetup.py Mon May 15 09:01:02 2023 +0200 @@ -457,12 +457,16 @@ def checkrequireslfiles(ui, repo, **kwargs): with repo.lock(): - if b'largefiles' not in repo.requirements and any( - lfutil.shortname + b'/' in entry.unencoded_path - for entry in repo.store.datafiles() - ): - repo.requirements.add(b'largefiles') - scmutil.writereporequirements(repo) + if b'largefiles' in repo.requirements: + return + marker = lfutil.shortnameslash + for entry in repo.store.datafiles(): + # XXX note that this match is not rooted and can wrongly match + # directory ending with ".hglf" + if entry.is_revlog and marker in entry.target_id: + repo.requirements.add(b'largefiles') + scmutil.writereporequirements(repo) + break ui.setconfig( b'hooks', b'changegroup.lfiles', checkrequireslfiles, b'largefiles'