changeset 45934:aba4f2c97e74

scmutil: try-delete `.hg/store/requires` if store requirements are empty When downgrading from a shared-safe repository to non-shared-safe repository, we end up in a case where we had requirements stored in `.hg/store/requires` but no longer want them there. Let's explicitly try delete the `.hg/store/requires` file if store requirements are empty. Differential Revision: https://phab.mercurial-scm.org/D9357
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 16 Oct 2020 19:03:09 +0530
parents ac565222b9f8
children 1441f4d57083
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Nov 23 10:39:51 2020 -0800
+++ b/mercurial/scmutil.py	Fri Oct 16 19:03:09 2020 +0530
@@ -1580,6 +1580,9 @@
         writerequires(repo.vfs, wcreq)
     if storereq is not None:
         writerequires(repo.svfs, storereq)
+    elif repo.ui.configbool(b'format', b'usestore'):
+        # only remove store requires if we are using store
+        repo.svfs.tryunlink(b'requires')
 
 
 def writerequires(opener, requirements):