mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
remove some internal uses of the term 'client'
Summary: Our use of the term "client" to refer to a checkout is deprecated. Rename some internal functions that use the term client. Reviewed By: simpkins Differential Revision: D21395159 fbshipit-source-id: fa96ba593f53b493e5ae816fa686f333a132c232
This commit is contained in:
parent
eb939cff57
commit
c4db2f39a9
@ -344,23 +344,20 @@ class EdenInstance:
|
||||
"""Return the paths of the set mount points stored in config.json"""
|
||||
return [str(path) for path in self._get_directory_map().keys()]
|
||||
|
||||
def get_all_client_config_info(self) -> Dict[str, collections.OrderedDict]:
|
||||
info = {}
|
||||
for path in self.get_mount_paths():
|
||||
info[path] = self.get_client_info(path)
|
||||
|
||||
return info
|
||||
|
||||
def get_thrift_client(self) -> eden.thrift.EdenClient:
|
||||
return eden.thrift.create_thrift_client(str(self._config_dir))
|
||||
|
||||
def get_client_info(self, path: Union[Path, str]) -> collections.OrderedDict:
|
||||
def get_checkout_info(self, path: Union[Path, str]) -> collections.OrderedDict:
|
||||
"""
|
||||
Given a path to a checkout, return a dictionary containing diagnostic
|
||||
information about it.
|
||||
"""
|
||||
path = Path(path).resolve(strict=False)
|
||||
client_dir = self._get_client_dir_for_mount_point(path)
|
||||
checkout = EdenCheckout(self, path, client_dir)
|
||||
return self.get_client_info_from_checkout(checkout)
|
||||
return self.get_checkout_info_from_checkout(checkout)
|
||||
|
||||
def get_client_info_from_checkout(
|
||||
def get_checkout_info_from_checkout(
|
||||
self, checkout: "EdenCheckout"
|
||||
) -> collections.OrderedDict:
|
||||
checkout_config = checkout.get_config()
|
||||
@ -370,7 +367,7 @@ class EdenInstance:
|
||||
("mount", str(checkout.path)),
|
||||
("scm_type", checkout_config.scm_type),
|
||||
("snapshot", snapshot),
|
||||
("client-dir", str(checkout.state_dir)),
|
||||
("state_dir", str(checkout.state_dir)),
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -209,17 +209,6 @@ class FakeEdenInstance:
|
||||
def check_health(self) -> HealthStatus:
|
||||
return HealthStatus(self._status, pid=None, detail="")
|
||||
|
||||
def get_client_info(self, mount_path: str) -> collections.OrderedDict:
|
||||
checkout = self._checkouts_by_path[mount_path]
|
||||
return collections.OrderedDict(
|
||||
[
|
||||
("mount", mount_path),
|
||||
("scm_type", checkout.config.scm_type),
|
||||
("snapshot", checkout.snapshot),
|
||||
("client-dir", checkout.state_dir),
|
||||
]
|
||||
)
|
||||
|
||||
def get_server_build_info(self) -> Dict[str, str]:
|
||||
return dict(self._build_info)
|
||||
|
||||
|
@ -102,7 +102,7 @@ class InfoCmd(Subcmd):
|
||||
|
||||
def run(self, args: argparse.Namespace) -> int:
|
||||
instance, checkout, _rel_path = require_checkout(args, args.client)
|
||||
info = instance.get_client_info_from_checkout(checkout)
|
||||
info = instance.get_checkout_info_from_checkout(checkout)
|
||||
json.dump(info, sys.stdout, indent=2)
|
||||
sys.stdout.write("\n")
|
||||
return 0
|
||||
@ -271,9 +271,8 @@ Legacy bind mount dirs listed above are unused and can be removed!
|
||||
self.underlined(f"Mount: {mount}")
|
||||
|
||||
instance, checkout, _rel_path = require_checkout(args, mount)
|
||||
info = instance.get_client_info_from_checkout(checkout)
|
||||
|
||||
client_dir = info["client-dir"]
|
||||
client_dir = checkout.state_dir
|
||||
overlay_dir = os.path.join(client_dir, "local")
|
||||
|
||||
self.usage_for_dir("Materialized files", overlay_dir)
|
||||
@ -281,7 +280,7 @@ Legacy bind mount dirs listed above are unused and can be removed!
|
||||
if self.isatty:
|
||||
print(f"Computing usage of ignored files...", end="", flush=True)
|
||||
scm_status = client.getScmStatus(
|
||||
bytes(checkout.path), True, info["snapshot"]
|
||||
bytes(checkout.path), True, checkout.get_snapshot().encode()
|
||||
)
|
||||
ignored_usage = 0
|
||||
buckd_usage = 0
|
||||
|
@ -60,12 +60,11 @@ def print_diagnostic_info(instance: EdenInstance, out: IO[bytes]) -> None:
|
||||
out.write(b"\nList of mount points:\n")
|
||||
mountpoint_paths = []
|
||||
for key in sorted(instance.get_mount_paths()):
|
||||
key_bytes = key.encode()
|
||||
out.write(key_bytes)
|
||||
mountpoint_paths.append(key_bytes)
|
||||
for key, val in instance.get_all_client_config_info().items():
|
||||
out.write(b"\nMount point info for path %s:\n" % key.encode())
|
||||
for k, v in val.items():
|
||||
out.write(key.encode() + b"\n")
|
||||
mountpoint_paths.append(key)
|
||||
for checkout_path in mountpoint_paths:
|
||||
out.write(b"\nMount point info for path %s:\n" % checkout_path.encode())
|
||||
for k, v in instance.get_checkout_info(checkout_path).items():
|
||||
out.write("{:>10} : {}\n".format(k, v).encode())
|
||||
if health_status.is_healthy():
|
||||
with io.StringIO() as stats_stream:
|
||||
|
@ -29,7 +29,7 @@ class InfoTest(testcase.EdenRepoTest):
|
||||
)
|
||||
self.assertEqual(
|
||||
{
|
||||
"client-dir": client_dir,
|
||||
"state_dir": client_dir,
|
||||
"scm_type": self.repo.get_type(),
|
||||
"mount": self.mount,
|
||||
"snapshot": self.repo.get_head_hash(),
|
||||
|
Loading…
Reference in New Issue
Block a user