aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mentz <danielmentz@google.com>2022-12-28 10:53:14 -0800
committerDaniel Mentz <danielmentz@google.com>2022-12-28 13:43:23 -0800
commitffb3d1c1972a116e651a1da0ecc88155daecdfe4 (patch)
treeabbf79a3a4d4478202b5222bb536ab270f538e27
parentc9b193c57e35d9b0d6e31a52b43eec3ca7cf1431 (diff)
downloadrepohooks-android-games-sdk-games-performance-tuner-release.tar.gz
Define placeholder REPO_PATH as the path to the project relative to the root. Previously, we provided this value only in the environment variable REPO_PATH. Change-Id: Icee1e9b1ea94ad4fde224cebef07a80811b9ce59 Signed-off-by: Daniel Mentz <danielmentz@google.com>
-rw-r--r--README.md1
-rw-r--r--rh/hooks.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/README.md b/README.md
index cd56dc3..5b8ffce 100644
--- a/README.md
+++ b/README.md
@@ -113,6 +113,7 @@ force your own quote handling.
Some variables are available to make it easier to handle OS differences. These
are automatically expanded for you:
+* `${REPO_PATH}`: The path to the project relative to the root.
* `${REPO_ROOT}`: The absolute path of the root of the repo checkout. If the
project is in a submanifest, this points to the root of the submanifest.
* `${REPO_OUTER_ROOT}`: The absolute path of the root of the repo checkout.
diff --git a/rh/hooks.py b/rh/hooks.py
index 4069b02..acf72af 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -129,6 +129,11 @@ class Placeholders(object):
return [x.file for x in self.diff if x.status != 'D']
@property
+ def var_REPO_PATH(self):
+ """The path to the project relative to the root"""
+ return os.environ.get('REPO_PATH', '')
+
+ @property
def var_REPO_ROOT(self):
"""The root of the repo (sub-manifest) checkout."""
return rh.git.find_repo_root()