##// END OF EJS Templates
narrow: drop the dedicated backup code...
marmoute -
r51083:39256bee default
parent child Browse files
Show More
@@ -2558,9 +2558,6 b' class localrepository:'
2558 else:
2558 else:
2559 # discard all changes (including ones already written
2559 # discard all changes (including ones already written
2560 # out) in this transaction
2560 # out) in this transaction
2561 narrowspec.restorebackup(self, b'journal.narrowspec')
2562 narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate')
2563
2564 repo.invalidate(clearfilecache=True)
2561 repo.invalidate(clearfilecache=True)
2565
2562
2566 tr = transaction.transaction(
2563 tr = transaction.transaction(
@@ -2688,8 +2685,6 b' class localrepository:'
2688 def _journalfiles(self):
2685 def _journalfiles(self):
2689 return (
2686 return (
2690 (self.svfs, b'journal'),
2687 (self.svfs, b'journal'),
2691 (self.svfs, b'journal.narrowspec'),
2692 (self.vfs, b'journal.narrowspec.dirstate'),
2693 (self.vfs, b'journal.branch'),
2688 (self.vfs, b'journal.branch'),
2694 (self.vfs, b'journal.desc'),
2689 (self.vfs, b'journal.desc'),
2695 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
2690 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
@@ -2701,8 +2696,6 b' class localrepository:'
2701
2696
2702 @unfilteredmethod
2697 @unfilteredmethod
2703 def _writejournal(self, desc):
2698 def _writejournal(self, desc):
2704 narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate')
2705 narrowspec.savebackup(self, b'journal.narrowspec')
2706 self.vfs.write(
2699 self.vfs.write(
2707 b"journal.branch", encoding.fromlocal(self.dirstate.branch())
2700 b"journal.branch", encoding.fromlocal(self.dirstate.branch())
2708 )
2701 )
@@ -2820,8 +2813,6 b' class localrepository:'
2820 self.dirstate.setparents(self.nullid)
2813 self.dirstate.setparents(self.nullid)
2821 self.dirstate.clear()
2814 self.dirstate.clear()
2822
2815
2823 narrowspec.restorebackup(self, b'undo.narrowspec')
2824 narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
2825 try:
2816 try:
2826 branch = self.vfs.read(b'undo.branch')
2817 branch = self.vfs.read(b'undo.branch')
2827 self.dirstate.setbranch(encoding.tolocal(branch))
2818 self.dirstate.setbranch(encoding.tolocal(branch))
@@ -14,7 +14,6 b' from . import ('
14 match as matchmod,
14 match as matchmod,
15 merge,
15 merge,
16 mergestate as mergestatemod,
16 mergestate as mergestatemod,
17 requirements,
18 scmutil,
17 scmutil,
19 sparse,
18 sparse,
20 util,
19 util,
@@ -242,46 +241,6 b' def copytoworkingcopy(repo):'
242 )
241 )
243
242
244
243
245 def savebackup(repo, backupname):
246 if requirements.NARROW_REQUIREMENT not in repo.requirements:
247 return
248 svfs = repo.svfs
249 svfs.tryunlink(backupname)
250 util.copyfile(svfs.join(FILENAME), svfs.join(backupname), hardlink=True)
251
252
253 def restorebackup(repo, backupname):
254 if requirements.NARROW_REQUIREMENT not in repo.requirements:
255 return
256 util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME))
257
258
259 def savewcbackup(repo, backupname):
260 if requirements.NARROW_REQUIREMENT not in repo.requirements:
261 return
262 vfs = repo.vfs
263 vfs.tryunlink(backupname)
264 # It may not exist in old repos
265 if vfs.exists(DIRSTATE_FILENAME):
266 util.copyfile(
267 vfs.join(DIRSTATE_FILENAME), vfs.join(backupname), hardlink=True
268 )
269
270
271 def restorewcbackup(repo, backupname):
272 if requirements.NARROW_REQUIREMENT not in repo.requirements:
273 return
274 # It may not exist in old repos
275 if repo.vfs.exists(backupname):
276 util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
277
278
279 def clearwcbackup(repo, backupname):
280 if requirements.NARROW_REQUIREMENT not in repo.requirements:
281 return
282 repo.vfs.tryunlink(backupname)
283
284
285 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
244 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
286 r"""Restricts the patterns according to repo settings,
245 r"""Restricts the patterns according to repo settings,
287 results in a logical AND operation
246 results in a logical AND operation
@@ -90,7 +90,6 b' Making sure store has the required files'
90 requires
90 requires
91 undo
91 undo
92 undo.backupfiles
92 undo.backupfiles
93 undo.narrowspec
94 undo.phaseroots
93 undo.phaseroots
95
94
96 Checking that repository has all the required data and not broken
95 Checking that repository has all the required data and not broken
General Comments 0
You need to be logged in to leave comments. Login now