[Updated] [+- ] D8631: localrepo: add writerequirements() and route requires writing through it
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Mon Jun 22 09:36:24 UTC 2020
pulkit updated this revision to Diff 21675.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8631?vs=21634&id=21675
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8631/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8631
AFFECTED FILES
mercurial/interfaces/repository.py
mercurial/localrepo.py
mercurial/sparse.py
mercurial/upgrade.py
CHANGE DETAILS
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
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()
elif b'exp-sparse' not in oldrequires:
repo.requirements.add(b'exp-sparse')
- scmutil.writerequires(repo.vfs, repo.requirements)
+ repo.writerequirements()
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()
writeconfig(repo, oldincludes, oldexcludes, oldprofiles)
raise
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1297,6 +1297,11 @@
caps.add(b'bundle2=' + urlreq.quote(capsblob))
return caps
+ def writerequirements(self, requirements=None):
+ if requirements:
+ self.requirements = requirements
+ self._writerequirements()
+
def _writerequirements(self):
scmutil.writerequires(self.vfs, self.requirements)
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=None):
+ """ writes current repository requirements """
+
class completelocalrepository(
ilocalrepositorymain, ilocalrepositoryfilestorage
To: pulkit, #hg-reviewers
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200622/03b0ada7/attachment-0002.html>
More information about the Mercurial-patches
mailing list