Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
getdeps optionally can get hg info from env var (#911)
Browse files Browse the repository at this point in the history
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

X-link: facebook/proxygen#401

X-link: facebook/openr#129

X-link: facebookarchive/fbzmq#35

X-link: facebook/fb303#26

Pull Request resolved: #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
  • Loading branch information
dgrnbrg-meta authored and facebook-github-bot committed Mar 12, 2022
1 parent be07ca4 commit 5f04063
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions build/fbcode_builder/getdeps/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,15 @@ def get_fbsource_repo_data(build_options) -> FbsourceRepoData:
if cached_data:
return cached_data

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

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

Expand Down

0 comments on commit 5f04063

Please sign in to comment.