diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -1809,6 +1809,9 @@ def savecommitmessage(text): pass + def writerequirements(requirements): + """ writes current repository requirements """ + class completelocalrepository( ilocalrepositorymain, ilocalrepositoryfilestorage diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1297,6 +1297,10 @@ caps.add(b'bundle2=' + urlreq.quote(capsblob)) return caps + def writerequirements(self, requirements): + self.requirements = requirements + self._writerequirements() + def _writerequirements(self): scmutil.writerequires(self.vfs, self.requirements) diff --git a/mercurial/sparse.py b/mercurial/sparse.py --- a/mercurial/sparse.py +++ b/mercurial/sparse.py @@ -21,7 +21,6 @@ mergestate as mergestatemod, pathutil, pycompat, - scmutil, util, ) from .utils import hashutil @@ -601,10 +600,10 @@ if b'exp-sparse' in oldrequires and removing: repo.requirements.discard(b'exp-sparse') - scmutil.writerequires(repo.vfs, repo.requirements) + repo.writerequirements(repo.requirements) elif b'exp-sparse' not in oldrequires: repo.requirements.add(b'exp-sparse') - scmutil.writerequires(repo.vfs, repo.requirements) + repo.writerequirements(repo.requirements) try: writeconfig(repo, includes, excludes, profiles) @@ -613,7 +612,7 @@ if repo.requirements != oldrequires: repo.requirements.clear() repo.requirements |= oldrequires - scmutil.writerequires(repo.vfs, repo.requirements) + repo.writerequirements(repo.requirements) writeconfig(repo, oldincludes, oldexcludes, oldprofiles) raise diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -21,7 +21,6 @@ metadata, pycompat, revlog, - scmutil, util, vfs as vfsmod, ) @@ -1091,9 +1090,7 @@ b'unable to read from repository\n' ) ) - scmutil.writerequires( - srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'} - ) + srcrepo.writerequirements(srcrepo.requirements | {b'upgradeinprogress'}) ui.status(_(b'starting in-place swap of repository data\n')) ui.status(_(b'replaced files will be backed up at %s\n') % backuppath) @@ -1122,7 +1119,7 @@ b'again\n' ) ) - scmutil.writerequires(srcrepo.vfs, requirements) + srcrepo.writerequirements(requirements) # The lock file from the old store won't be removed because nothing has a # reference to its new location. So clean it up manually. Alternatively, we