Skip to content

Commit

Permalink
Rename dist_git_changes to dist_git_merge_changes
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Jun 21, 2023
1 parent f62abfa commit 80e57ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion container_workflow_tool/constants.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion container_workflow_tool/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions container_workflow_tool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -77,15 +77,15 @@ 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
flexmock(GitOperations).should_receive("update_test_openshift_yaml").never()
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
Expand All @@ -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
Expand Down

0 comments on commit 80e57ad

Please sign in to comment.