mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
avoid writing conflicted repo requirements
Summary: See the previous diff for context. Basically, it's not a valid setup to be both a shallow (remotefilelog) and an eager repo. Detect that and avoid it. Reviewed By: muirdm Differential Revision: D43516086 fbshipit-source-id: 13b6eb41097478f1e5fa16c9282709c17f5d4ade
This commit is contained in:
parent
3a01cba6ff
commit
508bb1082e
@ -229,9 +229,15 @@ class HgRepository(repobase.Repository):
|
||||
hgrc["remotefilelog"]["cachepath"] = cachepath
|
||||
self.write_hgrc(hgrc)
|
||||
|
||||
requirespath = os.path.join(self.path, ".hg", "requires")
|
||||
with open(requirespath, "a") as f:
|
||||
f.write("remotefilelog\n")
|
||||
storerequirespath = os.path.join(self.path, ".hg", "store", "requires")
|
||||
with open(storerequirespath, "r") as f:
|
||||
storerequires = set(f.read().split())
|
||||
|
||||
# eagerepo conflicts with remotefilelog repo
|
||||
if "eagerepo" not in storerequires:
|
||||
requirespath = os.path.join(self.path, ".hg", "requires")
|
||||
with open(requirespath, "a") as f:
|
||||
f.write("remotefilelog\n")
|
||||
|
||||
def write_hgrc(self, hgrc: configparser.ConfigParser) -> None:
|
||||
hgrc_path = os.path.join(self.path, ".hg", "hgrc")
|
||||
|
Loading…
Reference in New Issue
Block a user