remove CheckoutConfig.hooks_path

Summary:
Remove the `CheckoutConfig.hooks_path` attribute which is no longer used
anywhere.

Reviewed By: strager

Differential Revision: D14356542

fbshipit-source-id: 28b7e7aeb197aeb5d04edf8adfdcfe7946ffa0c7
This commit is contained in:
Adam Simpkins 2019-03-08 11:06:47 -08:00 committed by Facebook Github Bot
parent 524bf4243d
commit 98ef256f4c
4 changed files with 3 additions and 18 deletions

View File

@ -108,7 +108,6 @@ class CheckoutConfig(typing.NamedTuple):
- backing_repo: The path where the true repo resides on disk. For mercurial backing
repositories this does not include the final ".hg" directory component.
- scm_type: "hg" or "git"
- hooks_path: path to where the hooks scripts are for the repo
- bind_mounts: dict where keys are private pathnames under ~/.eden where the
files are actually stored and values are the relative pathnames in the
EdenFS mount that maps to them.
@ -116,7 +115,6 @@ class CheckoutConfig(typing.NamedTuple):
backing_repo: Path
scm_type: str
hooks_path: str
bind_mounts: Dict[str, str]
default_revision: str
@ -278,15 +276,10 @@ class EdenInstance:
return CheckoutConfig(
backing_repo=Path(path),
scm_type=scm_type,
hooks_path=parser.get_str(repository_header, "hooks", default="")
or self.get_default_hooks_path(),
bind_mounts=bind_mounts,
default_revision=default_revision,
)
def get_default_hooks_path(self) -> str:
return os.path.join(self._etc_eden_dir, "hooks")
def get_mount_paths(self) -> Iterable[str]:
"""Return the paths of the set mount points stored in config.json"""
return self._get_directory_map().keys()
@ -470,7 +463,7 @@ Do you want to run `eden mount %s` instead?"""
def _post_clone_checkout_setup(
self, checkout: "EdenCheckout", commit_id: str
) -> None:
# First, check to see if the post-clone hook has been run successfully
# First, check to see if the post-clone setup has been run successfully
# before.
clone_success_path = checkout.state_dir / CLONE_SUCCEEDED
is_initial_mount = not clone_success_path.is_file()
@ -976,7 +969,6 @@ class EdenCheckout:
"repository": {
"path": str(checkout_config.backing_repo),
"type": checkout_config.scm_type,
"hooks": checkout_config.hooks_path,
},
"bind-mounts": checkout_config.bind_mounts,
}
@ -1033,7 +1025,6 @@ class EdenCheckout:
return CheckoutConfig(
backing_repo=Path(get_field("path")),
scm_type=scm_type,
hooks_path=get_field("hooks"),
bind_mounts=bind_mounts,
default_revision=(
repository.get("default-revision") or DEFAULT_REVISION[scm_type]

View File

@ -109,7 +109,6 @@ class FakeEdenInstance:
config = CheckoutConfig(
backing_repo=backing_repo_path,
scm_type=scm_type,
hooks_path="",
bind_mounts=bind_mounts,
default_revision=snapshot,
)

View File

@ -476,18 +476,16 @@ re-run `eden clone` with --allow-empty-repo"""
repo_config = config_mod.CheckoutConfig(
backing_repo=Path(repo.source),
scm_type=repo.type,
hooks_path=instance.get_default_hooks_path(),
bind_mounts={},
default_revision=config_mod.DEFAULT_REVISION[repo.type],
)
else:
# Build our own CheckoutConfig object, using our source repository
# path and type, but the hooks, bind-mount, and revision
# configuration from the project configuration.
# path and type, but the bind-mount and revision configuration from the
# project configuration.
repo_config = config_mod.CheckoutConfig(
backing_repo=Path(repo.source),
scm_type=repo.type,
hooks_path=project_config.hooks_path,
bind_mounts=project_config.bind_mounts,
default_revision=project_config.default_revision,
)

View File

@ -77,7 +77,6 @@ fbcode-buck-out = "fbcode/buck-out-override"
["repository git"]
type = "git"
path = "/home/${USER}/src/git/.git"
hooks = "/home/${USER}/my-git-hook"
"""
return cfg_file
@ -137,7 +136,6 @@ class TomlConfigTest(
assert cc is not None
self.assertEqual(cc.backing_repo, Path(f"/home/{self._user}/src/git/.git"))
self.assertEqual(cc.scm_type, "git")
self.assertEqual(cc.hooks_path, f"/home/{self._user}/my-git-hook")
self.assertEqual(cc.bind_mounts, {})
self.assertEqual(cc.default_revision, "master")
@ -237,7 +235,6 @@ class TomlConfigTest(
assert cc is not None
self.assertEqual(cc.backing_repo, Path(f"/data/users/{self._user}/fbandroid"))
self.assertEqual(cc.scm_type, "hg")
self.assertEqual(cc.hooks_path, f"{self._etc_eden_dir}/hooks")
self.assertEqual(cc.bind_mounts, {})
self.assertEqual(cc.default_revision, "master")