diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -143,6 +143,7 @@ node, pycompat, registrar, + repository, revlog, scmutil, templateutil, @@ -242,6 +243,7 @@ if any(ctx[f].islfs() for f in ctx.files() if f in ctx and match(f)): repo.requirements.add('lfs') + repo.features.add(repository.REPO_FEATURE_LFS) repo._writerequirements() repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) break @@ -306,6 +308,8 @@ wrapfunction = extensions.wrapfunction + wrapfunction(localrepo, 'makefilestorage', wrapper.localrepomakefilestorage) + wrapfunction(cmdutil, '_updatecatformatter', wrapper._updatecatformatter) wrapfunction(scmutil, 'wrapconvertsink', wrapper.convertsink) diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -14,6 +14,7 @@ from mercurial import ( error, + repository, revlog, util, ) @@ -29,6 +30,12 @@ pointer, ) +def localrepomakefilestorage(orig, requirements, features, **kwargs): + if b'lfs' in requirements: + features.add(repository.REPO_FEATURE_LFS) + + return orig(requirements=requirements, features=features, **kwargs) + def allsupportedversions(orig, ui): versions = orig(ui) versions.add('03') diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -25,6 +25,8 @@ REPO_FEATURE_REVLOG_FILE_STORAGE = b'revlogfilestorage' # The storage part of the repository is shared from an external source. REPO_FEATURE_SHARED_STORAGE = b'sharedstore' +# LFS supported for backing file storage. +REPO_FEATURE_LFS = b'lfs' class ipeerconnection(interfaceutil.Interface): """Represents a "connection" to a repository.