repohooks: pass through REPO_PROJECT

Bug: 340801952
Test: python rh/hooks_unittest.py
Change-Id: I483aaf4b8458b915089cd436b3b5ef1edb30e448
diff --git a/README.md b/README.md
index 5b8ffce..3741fd9 100644
--- a/README.md
+++ b/README.md
@@ -114,6 +114,9 @@
 are automatically expanded for you:
 
 * `${REPO_PATH}`: The path to the project relative to the root.
+  e.g. `tools/repohooks`
+* `${REPO_PROJECT}`: The name of the project.
+  e.g. `platform/tools/repohooks`
 * `${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 6cb92a0..c798298 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -134,6 +134,11 @@
         return os.environ.get('REPO_PATH', '')
 
     @property
+    def var_REPO_PROJECT(self):
+        """The name of the project"""
+        return os.environ.get('REPO_PROJECT', '')
+
+    @property
     def var_REPO_ROOT(self):
         """The root of the repo (sub-manifest) checkout."""
         return rh.git.find_repo_root()
diff --git a/rh/hooks_unittest.py b/rh/hooks_unittest.py
index 003057e..c261967 100755
--- a/rh/hooks_unittest.py
+++ b/rh/hooks_unittest.py
@@ -197,6 +197,13 @@
         os.environ['REPO_PATH'] = 'foo/bar'
         self.assertEqual(self.replacer.get('REPO_PATH'), 'foo/bar')
 
+    def testREPO_PROJECT(self):
+        """Verify handling of REPO_PROJECT."""
+        os.environ['REPO_PROJECT'] = ''
+        self.assertEqual(self.replacer.get('REPO_PROJECT'), '')
+        os.environ['REPO_PROJECT'] = 'platform/foo/bar'
+        self.assertEqual(self.replacer.get('REPO_PROJECT'), 'platform/foo/bar')
+
     @mock.patch.object(rh.hooks, '_get_build_os_name', return_value='vapier os')
     def testBUILD_OS(self, m):
         """Verify handling of BUILD_OS."""