osmith has uploaded this change for review.

View Change

obs: lib.git.get_default_branch: add function

Refactor checkout_default_branch so the get_default_branch logic can be
used from another function in a future patch.

Related: OS#2385
Change-Id: If3f0ab500ff165d81f61b19ad41af90bd39dce8f
---
M scripts/obs/lib/git.py
1 file changed, 6 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/92/29592/1
diff --git a/scripts/obs/lib/git.py b/scripts/obs/lib/git.py
index 8dc57ae..aab0533 100644
--- a/scripts/obs/lib/git.py
+++ b/scripts/obs/lib/git.py
@@ -65,11 +65,14 @@
lib.run_cmd(["git", "review", "-d", str(gerrit_id)], cwd=repo_path)


-def checkout_default_branch(project):
- branch = lib.config.git_branch_default
+def get_default_branch(project):
if project in lib.config.git_branch_other:
- branch = lib.config.git_branch_other[project]
+ return lib.config.git_branch_other[project]
+ return lib.config.git_branch_default

+
+def checkout_default_branch(project):
+ branch = get_default_branch(project)
checkout(project, f"origin/{branch}")



To view, visit change 29592. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: If3f0ab500ff165d81f61b19ad41af90bd39dce8f
Gerrit-Change-Number: 29592
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange