D9357: scmutil: try-delete `.hg/store/requires` if store requirements are empty

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Nov 21 13:07:51 UTC 2020


pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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 is store requirements
  are empty.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9357

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1613,6 +1613,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):



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list