diff options
| author | Chih-Hung Hsieh <chh@google.com> | 2020-08-17 23:13:59 -0700 |
|---|---|---|
| committer | Chih-Hung Hsieh <chh@google.com> | 2020-08-18 15:09:32 -0700 |
| commit | b298bcd7669923faa9753810c6675e56b76df2a5 (patch) | |
| tree | 8f9dedfe09944030b3036e18ed04af33ab85fda9 /git_utils.py | |
| parent | e8c98de52551020ad857b106d45f026ee607d6f4 (diff) | |
| download | platform_tools_external_updater-b298bcd7669923faa9753810c6675e56b76df2a5.tar.gz platform_tools_external_updater-b298bcd7669923faa9753810c6675e56b76df2a5.tar.bz2 platform_tools_external_updater-b298bcd7669923faa9753810c6675e56b76df2a5.zip | |
Add default Rust project reviewers and Test tag
* Add default reviewers for a few external/rust/crates projects;
more could be added later.
When a rust project is not found in the map,
a random reviewers is picked from a list.
* Add a Test tag to git commit message.
Bug: 162988933
Test: out/.../bin/external_updater update --branch_and_commit --push_change <some_project>
Change-Id: I3f04dce0b801e4f33980a57347a2affd1438ead0
Diffstat (limited to 'git_utils.py')
| -rw-r--r-- | git_utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/git_utils.py b/git_utils.py index 69dcfba..5402af9 100644 --- a/git_utils.py +++ b/git_utils.py @@ -19,6 +19,7 @@ import subprocess from pathlib import Path from typing import Dict, List, Tuple +import reviewers def _run(cmd: List[str], cwd: Path) -> str: """Runs a command and returns its output.""" @@ -161,4 +162,8 @@ def checkout(proj_path: Path, branch_name: str) -> None: def push(proj_path: Path, remote_name: str) -> None: """Pushes change to remote.""" - _run(['git', 'push', remote_name, 'HEAD:refs/for/master'], cwd=proj_path) + reviewer = reviewers.find_reviewer(str(proj_path)) + if reviewer: # no '%r=' parameter if there is no reviewer found + reviewer = '%r=' + reviewer + _run(['git', 'push', remote_name, 'HEAD:refs/for/master' + reviewer], + cwd=proj_path) |
