narrow: keep narrowspec backup in store
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 10 Dec 2018 10:39:48 -0800
changeset 41041 1e8d9f472ea1
parent 41040 92fde28860bb
child 41042 7db1619af061
narrow: keep narrowspec backup in store As suggested by Yuya in review of D4099. Differential Revision: https://phab.mercurial-scm.org/D5470
mercurial/narrowspec.py
tests/test-narrow-clone-stream.t
--- a/mercurial/narrowspec.py	Sat Oct 27 22:56:31 2018 -0700
+++ b/mercurial/narrowspec.py	Mon Dec 10 10:39:48 2018 -0800
@@ -160,19 +160,19 @@
 def savebackup(repo, backupname):
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return
-    vfs = repo.vfs
-    vfs.tryunlink(backupname)
-    util.copyfile(repo.svfs.join(FILENAME), vfs.join(backupname), hardlink=True)
+    svfs = repo.svfs
+    svfs.tryunlink(backupname)
+    util.copyfile(svfs.join(FILENAME), svfs.join(backupname), hardlink=True)
 
 def restorebackup(repo, backupname):
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return
-    util.rename(repo.vfs.join(backupname), repo.svfs.join(FILENAME))
+    util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME))
 
 def clearbackup(repo, backupname):
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return
-    repo.vfs.unlink(backupname)
+    repo.svfs.unlink(backupname)
 
 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
     r""" Restricts the patterns according to repo settings,
--- a/tests/test-narrow-clone-stream.t	Sat Oct 27 22:56:31 2018 -0700
+++ b/tests/test-narrow-clone-stream.t	Mon Dec 10 10:39:48 2018 -0800
@@ -77,6 +77,7 @@
   00manifest.i
   data (tree flat-fncache !)
   fncache (tree flat-fncache !)
+  journal.narrowspec
   meta (tree !)
   narrowspec
   undo