unify helper vars across all sections
Make it easier for PREUPLOAD.cfg writers to access any of the replacement
vars in different contexts rather than making them section-specific.
Bug: 32317688
Test: a modified PREUPLOAD.cfg with $REPO_ROOT in Hook Scripts works
Test: ran the new hooks_unittest!
Change-Id: I20dac8eeff78ce4f062dbaf8f7354df420e82d7d
diff --git a/pre-upload.py b/pre-upload.py
index cc8d24a..f15a9b7 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -23,7 +23,6 @@
from __future__ import print_function
import argparse
-import collections
import os
import sys
@@ -38,6 +37,7 @@
sys.path.insert(0, _path)
del _path
+import rh
import rh.results
import rh.config
import rh.git
@@ -50,9 +50,6 @@
REPOHOOKS_URL = 'https://android.googlesource.com/platform/tools/repohooks/'
-Project = collections.namedtuple('Project', ['name', 'dir', 'remote'])
-
-
class Output(object):
"""Class for reporting hook status."""
@@ -219,7 +216,7 @@
})
output = Output(project_name, len(hooks))
- project = Project(name=project_name, dir=proj_dir, remote=remote)
+ project = rh.Project(name=project_name, dir=proj_dir, remote=remote)
if not commit_list:
commit_list = rh.git.get_commits(