convert a path to valid glob syntax when prefetching

Summary:
Paths are not necessarily legal glob syntax. In particular, backslash
is used for escaping. This caused problems on Windows, where we tried
to pass a backslash-delimited path into `eden prefetch --no-prefetch`.

Reviewed By: xavierd

Differential Revision: D25072784

fbshipit-source-id: 9ce8e5ccc8f28581512c39d04922889da0bc1bf6
This commit is contained in:
Chad Austin 2020-11-18 17:30:00 -08:00 committed by Facebook GitHub Bot
parent dc6b1a368e
commit ac8d6441f9

View File

@ -59,11 +59,9 @@ def prefetch_dir_if_eden(dirpath):
root = find_eden_root(dirpath)
if root is None:
return
rel = os.path.relpath(dirpath, root)
print("Prefetching %s..." % rel)
subprocess.call(
["edenfsctl", "prefetch", "--repo", root, "--silent", "%s/**" % rel]
)
glob = f"{os.path.relpath(dirpath, root).replace(os.sep, '/')}/**"
print(f"Prefetching {glob}")
subprocess.call(["edenfsctl", "prefetch", "--repo", root, "--silent", glob])
PREFETCHED_DIRS.add(dirpath)