Skip to content

Commit d579cdd

Browse files
dgrnbrg-metafacebook-github-bot
authored andcommitted
getdeps optionally can get hg info from env var (#911)
Summary: X-link: rsocket/rsocket-cpp#911 X-link: facebookexperimental/rust-shed#32 X-link: facebookincubator/reindeer#3 X-link: https://github.com/fairinternal/AIRStore/pull/36 X-link: facebookincubator/velox#1197 X-link: facebook/mvfst#242 X-link: facebook/sapling#116 X-link: facebookincubator/fizz#75 X-link: facebookincubator/katran#157 X-link: facebook/watchman#1011 X-link: facebook/wangle#205 Pull Request resolved: #401 X-link: facebook/openr#129 X-link: facebookarchive/fbzmq#35 X-link: facebook/fb303#26 X-link: facebookarchive/bistro#59 X-link: facebook/folly#1734 X-link: facebook/fboss#113 Adds an environment variable to getdeps to provide `hg` info to avoid calling `hg` directly. When using `getdeps` inside a containerized environment (which we need to build Research Super Cluster tooling with the correct linker attributes), `getdeps` fails because of unregistered mercurial extensions in the `hgrc`. This allows `getdeps` to be useable in an environment where the mercurial extensions used in a project aren't installed/available. Reviewed By: vivekspai Differential Revision: D34732506 fbshipit-source-id: 6475088fbf3323347095ca5af8a902382cf8f9d0
1 parent 8dfded2 commit d579cdd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

build/fbcode_builder/getdeps/fetcher.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,15 @@ def get_fbsource_repo_data(build_options) -> FbsourceRepoData:
525525
if cached_data:
526526
return cached_data
527527

528-
cmd = ["hg", "log", "-r.", "-T{node}\n{date|hgdate}"]
529-
env = Env()
530-
env.set("HGPLAIN", "1")
531-
log_data = subprocess.check_output(
532-
cmd, cwd=build_options.fbsource_dir, env=dict(env.items())
533-
).decode("ascii")
528+
if "GETDEPS_HG_REPO_DATA" in os.environ:
529+
log_data = os.environ["GETDEPS_HG_REPO_DATA"]
530+
else:
531+
cmd = ["hg", "log", "-r.", "-T{node}\n{date|hgdate}"]
532+
env = Env()
533+
env.set("HGPLAIN", "1")
534+
log_data = subprocess.check_output(
535+
cmd, cwd=build_options.fbsource_dir, env=dict(env.items())
536+
).decode("ascii")
534537

535538
(hash, datestr) = log_data.split("\n")
536539

0 commit comments

Comments
 (0)