From 80e57ad69a6587abc547a99c6632d6d34665f2aa Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 21 Jun 2023 12:36:17 +0200 Subject: [PATCH] Rename dist_git_changes to dist_git_merge_changes Signed-off-by: Petr "Stone" Hracek --- container_workflow_tool/constants.py | 2 +- container_workflow_tool/distgit.py | 2 +- container_workflow_tool/main.py | 6 +++--- tests/test_distgit.py | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/container_workflow_tool/constants.py b/container_workflow_tool/constants.py index f2aa518..c1d7945 100644 --- a/container_workflow_tool/constants.py +++ b/container_workflow_tool/constants.py @@ -1,6 +1,6 @@ action_map = {} action_map['git'] = { - 'pullupstream': 'dist_git_changes', + 'pullupstream': 'dist_git_merge_changes', 'clonedownstream': 'pull_downstream', 'cloneupstream': 'pull_upstream', 'rebase': 'dist_git_rebase', diff --git a/container_workflow_tool/distgit.py b/container_workflow_tool/distgit.py index f4989c4..66afbe5 100644 --- a/container_workflow_tool/distgit.py +++ b/container_workflow_tool/distgit.py @@ -53,7 +53,7 @@ def check_script(self, component, script_path, component_path): else: self.logger.info(template.format(name=component, status="OK")) - def dist_git_changes(self, images, rebase=False): + def dist_git_merge_changes(self, images, rebase=False): """Method to merge changes from upstream into downstream Pulls both downstream and upstream repositories into a temporary dir. diff --git a/container_workflow_tool/main.py b/container_workflow_tool/main.py index 80d95df..987e7e7 100755 --- a/container_workflow_tool/main.py +++ b/container_workflow_tool/main.py @@ -552,7 +552,7 @@ def dist_git_rebase(self): Do a rebase against a new base/s2i image. Does not pull in upstream changes of layered images. """ - self.dist_git_changes(rebase=True) + self.dist_git_merge_changes(rebase=True) def git_changes_report(self, tmp): self.logger.info("\nGit location: " + tmp) @@ -566,7 +566,7 @@ def git_changes_report(self, tmp): "cwt git push && cwt build" "[base/core/s2i] --repo-url link-to-repo-file") - def dist_git_changes(self, rebase: bool = False): + def dist_git_merge_changes(self, rebase: bool = False): """Method to merge changes from upstream into downstream Pulls both downstream and upstream repositories into a temporary directory. @@ -576,7 +576,7 @@ def dist_git_changes(self, rebase: bool = False): rebase (bool, optional): Specifies whether a rebase should be done instead. """ tmp, images = self.preparation() - self.distgit.dist_git_changes(images, rebase) + self.distgit.dist_git_merge_changes(images, rebase) self.git_changes_report(tmp=tmp) def merge_future_branches(self): diff --git a/tests/test_distgit.py b/tests/test_distgit.py index f12bdf2..38e548e 100644 --- a/tests/test_distgit.py +++ b/tests/test_distgit.py @@ -62,10 +62,10 @@ def test_pull_upstream(self): assert os.path.isfile(dpath) @pytest.mark.distgit - def test_distgit_changes(self): + def test_distgit_merge_changes(self): self.ir.conf["from_tag"] = "test" tmp = Path(self.ir._get_tmp_workdir()) - self.ir.dist_git_changes() + self.ir.dist_git_merge_changes() dpath = tmp / self.component / 'Dockerfile' assert os.path.isfile(dpath) assert not (tmp / self.component / "test" / "test-openshift.yaml").exists() @@ -77,7 +77,7 @@ def test_distgit_changes(self): shutil.rmtree(tmp / self.component) @pytest.mark.distgit - def test_distgit_changes_openshift_yaml(self): + def test_distgit_merge_changes_openshift_yaml(self): # TODO # As soon as s2i-base-container will contain file 'test/test-openshift.yaml' # Then change it to once @@ -85,7 +85,7 @@ def test_distgit_changes_openshift_yaml(self): self.ir.conf["from_tag"] = "test" tmp = Path(self.ir._get_tmp_workdir()) self.ir.distgit._clone_downstream(self.component, "main") - self.ir.dist_git_changes() + self.ir.dist_git_merge_changes() dpath = tmp / self.component / 'Dockerfile' assert os.path.isfile(dpath) tag_found = False @@ -99,7 +99,7 @@ def test_distgit_changes_openshift_yaml(self): def test_tag_dockerfile(self): tmp = Path(self.ir._get_tmp_workdir()) self.ir.conf["from_tag"] = "test" - self.ir.dist_git_changes() + self.ir.dist_git_merge_changes() cpath = tmp / self.component dpath = cpath / 'Dockerfile' found_tag = False