sapling/scripts/with-hg-dev
Jun Wu 31a03cf10c arc: source hg-dev automatically
Summary:
This is a follow-up of D4788756 and makes it easier to run `arc unit` or
`arc lint`.

Test Plan:
Run `arc lint` and `arc unit` without sourcing `hg-dev` first. And also rename
`facebook-hg-rpms` to make sure it aborts if `hg-dev` cannot be found.

Reviewers: simpkins, #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: net-systems-diffs@fb.com, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4831818

Signature: t1:4831818:1491382785:35f6537722502d3c63cb65cf7129564b26903201
2017-04-05 13:17:03 -07:00

27 lines
547 B
Bash
Executable File

#!/bin/bash
#
# Run scripts with hg-dev environment. Examples:
#
# with-hg-dev ./lint.py
# with-hg-dev ./unit.py
#
# Exit 40 if hg-dev cannot be found, or does not have desired effect.
SCRIPT_PATH="${BASH_SOURCE[0]:-$0}"
builtin cd $(dirname "$SCRIPT_PATH")
if [[ -z $HG_DEV_DIR ]]; then
for path in ../../hg-dev ${HG_RPM_DIR:-~/facebook-hg-rpms/hg-dev}; do
if [[ -f "$path" ]]; then
source "$path"
break
fi
done
if [[ -z $HG_DEV_DIR ]]; then
echo abort: cannot find hg-dev 1>&2
exit 40
fi
fi
command $@