diff options
author | Dan Albert <danalbert@google.com> | 2023-03-24 16:13:39 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-24 16:13:39 +0000 |
commit | f022a1bc24eb394c9737e49ebe08ab6088f6e083 (patch) | |
tree | 2de5570758a87cb6135b719f8729b825f93056de | |
parent | 65467a85df11fe221e80c99c7259679133426686 (diff) | |
parent | a3fa00756688a36fb9818af129e3662fb6664a62 (diff) | |
download | external_updater-f022a1bc24eb394c9737e49ebe08ab6088f6e083.tar.gz |
Handle pore trees. am: b50f162c9e am: 8ef34462cb am: a572d4fa57 am: a3fa007566
Original change: https://android-review.googlesource.com/c/platform/tools/external_updater/+/2506730
Change-Id: Iadab6365ce115808d9f2cddc7b773cab2d2fa288
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | git_utils.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/git_utils.py b/git_utils.py index 7740af1..75a2a24 100644 --- a/git_utils.py +++ b/git_utils.py @@ -197,9 +197,24 @@ def delete_branch(proj_path: Path, branch_name: str) -> None: subprocess.run(cmd, cwd=proj_path, check=True) +def tree_uses_pore(proj_path: Path) -> bool: + """Returns True if the tree uses pore rather than repo. + + https://github.com/jmgao/pore + """ + if proj_path == proj_path.root: + return False + if (proj_path / ".pore").exists(): + return True + return tree_uses_pore(proj_path.parent) + + def start_branch(proj_path: Path, branch_name: str) -> None: """Starts a new repo branch.""" - cmd = ['repo', 'start', branch_name] + repo = 'repo' + if tree_uses_pore(proj_path): + repo = 'pore' + cmd = [repo, 'start', branch_name] subprocess.run(cmd, cwd=proj_path, check=True) |