add backing repo location to eden info

Summary: It's worth making backing repos easier to find. This should help us remove hardcoded paths from our wikis/reclone instructions. This should also make it easier for users who use custom backing repos to find their backing repo location if they ever forget.

Reviewed By: chadaustin

Differential Revision: D40455968

fbshipit-source-id: 107b7325ff64015b814c4c30680f982a3518de56
This commit is contained in:
Michael Cuevas 2022-10-20 14:33:19 -07:00 committed by Facebook GitHub Bot
parent a4f9d57f54
commit 1d779fa32b
3 changed files with 14 additions and 0 deletions

View File

@ -488,6 +488,7 @@ class EdenInstance(AbstractEdenInstance):
("state_dir", str(checkout.state_dir)), ("state_dir", str(checkout.state_dir)),
("mount_protocol", checkout_config.mount_protocol), ("mount_protocol", checkout_config.mount_protocol),
("case_sensitive", checkout_config.case_sensitive), ("case_sensitive", checkout_config.case_sensitive),
("backing_repo", str(checkout.get_backing_repo_path())),
] ]
) )
@ -1451,6 +1452,9 @@ class EdenCheckout:
repo_path = self.get_config().backing_repo repo_path = self.get_config().backing_repo
return self.instance.get_hg_repo(repo_path) return self.instance.get_hg_repo(repo_path)
def get_backing_repo_path(self) -> Path:
return self.get_config().backing_repo
def activate_profile( def activate_profile(
self, self,
profile: str, profile: str,

View File

@ -28,6 +28,7 @@ class InfoTest(testcase.EdenRepoTest):
client_dir = os.path.join( client_dir = os.path.join(
self.eden_dir, "clients", os.path.basename(self.mount) self.eden_dir, "clients", os.path.basename(self.mount)
) )
backing_repo = str(self.get_backing_dir(self.repo_name, self.repo.get_type()))
# We don't care about the exact case sensitivity value here; it's # We don't care about the exact case sensitivity value here; it's
# tested elsewhere. # tested elsewhere.
@ -40,6 +41,7 @@ class InfoTest(testcase.EdenRepoTest):
"scm_type": self.repo.get_type(), "scm_type": self.repo.get_type(),
"mount": self.mount, "mount": self.mount,
"mount_protocol": get_protocol(self.use_nfs()), "mount_protocol": get_protocol(self.use_nfs()),
"backing_repo": backing_repo,
"checked_out_revision": self.repo.get_head_hash(), "checked_out_revision": self.repo.get_head_hash(),
"working_copy_parent": self.repo.get_head_hash(), "working_copy_parent": self.repo.get_head_hash(),
}, },

View File

@ -40,6 +40,8 @@ except ImportError:
# Thrift-py3 is not supported in the CMake build yet. # Thrift-py3 is not supported in the CMake build yet.
pass pass
from pathlib import Path
from facebook.eden.ttypes import SourceControlType from facebook.eden.ttypes import SourceControlType
from . import edenclient, gitrepo, hgrepo, repobase, skip from . import edenclient, gitrepo, hgrepo, repobase, skip
@ -211,6 +213,12 @@ class EdenTestCase(EdenTestCaseBase):
thrift_client.flushStatsNow() thrift_client.flushStatsNow()
return thrift_client.getCounters() return thrift_client.getCounters()
def get_backing_dir(self, reponame: str, repo_type: str) -> Path:
backing_dir_location = Path(self.repos_dir) / reponame
return (
backing_dir_location if repo_type == "hg" else backing_dir_location / ".git"
)
def edenfs_logging_settings(self) -> Optional[Dict[str, str]]: def edenfs_logging_settings(self) -> Optional[Dict[str, str]]:
""" """
Get the log settings to pass to edenfs via the --logging argument. Get the log settings to pass to edenfs via the --logging argument.