aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2023-03-24 16:13:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-03-24 16:13:39 +0000
commitf022a1bc24eb394c9737e49ebe08ab6088f6e083 (patch)
tree2de5570758a87cb6135b719f8729b825f93056de
parent65467a85df11fe221e80c99c7259679133426686 (diff)
parenta3fa00756688a36fb9818af129e3662fb6664a62 (diff)
downloadexternal_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.py17
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)