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
--- 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):