mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
cli: when printing mounts, always use forward slash
Summary: On Windows, printing paths by default use backward slashes, but forward slashses are also acceptable. For the sake of making tests pass, let's always use forward slashes. Reviewed By: chadaustin Differential Revision: D32960607 fbshipit-source-id: c1424c4a090d805bab337fc6d540563e8205e5dc
This commit is contained in:
parent
61b6ad7bcb
commit
9dd8d50e98
@ -171,12 +171,12 @@ class ListMountInfo(typing.NamedTuple):
|
||||
|
||||
def to_json_dict(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"data_dir": str(self.data_dir),
|
||||
"data_dir": self.data_dir.as_posix(),
|
||||
"state": MountState._VALUES_TO_NAMES.get(self.state)
|
||||
if self.state is not None
|
||||
else "NOT_RUNNING",
|
||||
"configured": self.configured,
|
||||
"backing_repo": str(self.backing_repo)
|
||||
"backing_repo": self.backing_repo.as_posix()
|
||||
if self.backing_repo is not None
|
||||
else None,
|
||||
}
|
||||
|
@ -608,7 +608,8 @@ class ListCmd(Subcmd):
|
||||
out: ui.Output, mount_points: Dict[Path, ListMountInfo]
|
||||
) -> None:
|
||||
data = {
|
||||
str(mount.path): mount.to_json_dict() for mount in mount_points.values()
|
||||
mount.path.as_posix(): mount.to_json_dict()
|
||||
for mount in mount_points.values()
|
||||
}
|
||||
json_str = json.dumps(data, sort_keys=True, indent=2)
|
||||
out.writeln(json_str)
|
||||
@ -631,7 +632,7 @@ class ListCmd(Subcmd):
|
||||
state_name = MountState._VALUES_TO_NAMES[mount_info.state]
|
||||
state_str = f" ({state_name})"
|
||||
|
||||
out.writeln(f"{path}{state_str}{suffix}")
|
||||
out.writeln(f"{path.as_posix()}{state_str}{suffix}")
|
||||
|
||||
|
||||
class RepoError(Exception):
|
||||
|
Loading…
Reference in New Issue
Block a user