Skip to content
Snippets Groups Projects
Commit 872ec6d9 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Refactoring: swap if and else branches

Move the main part of the action to the if branch.

See for reference:
https://docs.sourcery.ai/Reference/Python/Default-Rules/swap-if-else-branches/
parent c058236c
No related branches found
No related tags found
1 merge request!299Refactoring: swap if and else branches
Pipeline #72626 skipped with stage
...@@ -298,13 +298,9 @@ def update_submodule_and_include_ref( ...@@ -298,13 +298,9 @@ def update_submodule_and_include_ref(
logging.debug("Head of %s points to %s", branch, integration_base_id) logging.debug("Head of %s points to %s", branch, integration_base_id)
# Loop over the commits until the integration_branch head id is found # Loop over the commits until the integration_branch head id is found
if not common.is_commit_parent_of_project_commit( if common.is_commit_parent_of_project_commit(
project, existing_branch.commit["id"], integration_base_id, limit=5 project, existing_branch.commit["id"], integration_base_id, limit=5
): ):
logging.debug("Integration branch is outdated, delete it.")
project.branches.delete(existing_branch.name)
existing_branch = None
else:
# Check the submodule revision on the integration branch # Check the submodule revision on the integration branch
( (
_, _,
...@@ -325,6 +321,10 @@ def update_submodule_and_include_ref( ...@@ -325,6 +321,10 @@ def update_submodule_and_include_ref(
) )
integration_commit = existing_branch.commit["id"] integration_commit = existing_branch.commit["id"]
submodule_update_needed = False submodule_update_needed = False
else:
logging.debug("Integration branch is outdated, delete it.")
project.branches.delete(existing_branch.name)
existing_branch = None
# Clone the project, we need to do changes # Clone the project, we need to do changes
if submodule_update_needed or force_clone: if submodule_update_needed or force_clone:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment