diff mercurial/narrowspec.py @ 50188:39256bee2ed9

narrow: drop the dedicated backup code Now that the transaction manage the writes, we can simply use the transaction for backup. Some extra cleanup to ensure all changes happens within a transaction will be made in the next changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Feb 2023 03:28:44 +0100
parents f18e4608bb61
children 6794f927bc48
line wrap: on
line diff
--- a/mercurial/narrowspec.py	Thu Feb 23 03:25:44 2023 +0100
+++ b/mercurial/narrowspec.py	Thu Feb 23 03:28:44 2023 +0100
@@ -14,7 +14,6 @@
     match as matchmod,
     merge,
     mergestate as mergestatemod,
-    requirements,
     scmutil,
     sparse,
     util,
@@ -242,46 +241,6 @@
         )
 
 
-def savebackup(repo, backupname):
-    if requirements.NARROW_REQUIREMENT not in repo.requirements:
-        return
-    svfs = repo.svfs
-    svfs.tryunlink(backupname)
-    util.copyfile(svfs.join(FILENAME), svfs.join(backupname), hardlink=True)
-
-
-def restorebackup(repo, backupname):
-    if requirements.NARROW_REQUIREMENT not in repo.requirements:
-        return
-    util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME))
-
-
-def savewcbackup(repo, backupname):
-    if requirements.NARROW_REQUIREMENT not in repo.requirements:
-        return
-    vfs = repo.vfs
-    vfs.tryunlink(backupname)
-    # It may not exist in old repos
-    if vfs.exists(DIRSTATE_FILENAME):
-        util.copyfile(
-            vfs.join(DIRSTATE_FILENAME), vfs.join(backupname), hardlink=True
-        )
-
-
-def restorewcbackup(repo, backupname):
-    if requirements.NARROW_REQUIREMENT not in repo.requirements:
-        return
-    # It may not exist in old repos
-    if repo.vfs.exists(backupname):
-        util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
-
-
-def clearwcbackup(repo, backupname):
-    if requirements.NARROW_REQUIREMENT not in repo.requirements:
-        return
-    repo.vfs.tryunlink(backupname)
-
-
 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
     r"""Restricts the patterns according to repo settings,
     results in a logical AND operation