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

login
register
mail settings
Submitter phabricator
Date Nov. 21, 2020, 1:07 p.m.
Message ID <differential-rev-PHID-DREV-i72mm6va4ojqcoedjew3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47635/
State Superseded
Headers show

Comments

phabricator - Nov. 21, 2020, 1:07 p.m.
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




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

Patch

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