Remove PDC from scm_request_processor
Remove PDC calls from scm_request_processor. Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
parent
5a5caa32dd
commit
b7508a408d
4 changed files with 28 additions and 238 deletions
Binary file not shown.
Before Width: | Height: | Size: 728 KiB After Width: | Height: | Size: 728 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 354 KiB |
|
@ -134,13 +134,10 @@ class TestProcess:
|
|||
pagure_user
|
||||
)
|
||||
|
||||
@patch("toddlers.utils.pdc.set_pdc")
|
||||
@patch("toddlers.utils.pagure.set_pagure")
|
||||
@patch("toddlers.utils.fedora_account.set_fasjson")
|
||||
@patch("toddlers.utils.bugzilla_system.set_bz")
|
||||
def test_process_exception(
|
||||
self, mock_bugzilla, mock_fasjson, mock_pagure, mock_pdc, toddler
|
||||
):
|
||||
def test_process_exception(self, mock_bugzilla, mock_fasjson, mock_pagure, toddler):
|
||||
"""
|
||||
Assert that message toddler will be initialized correctly, if message passes
|
||||
initial processing.
|
||||
|
@ -173,7 +170,6 @@ class TestProcess:
|
|||
|
||||
mock_process_ticket.assert_called_with(issue)
|
||||
|
||||
mock_pdc.assert_called_with(config)
|
||||
mock_pagure.assert_has_calls(
|
||||
[
|
||||
call(config),
|
||||
|
@ -189,11 +185,10 @@ class TestProcess:
|
|||
mock_bugzilla.assert_called_with(config)
|
||||
mock_pagure_io.add_comment_to_issue.assert_called_once()
|
||||
|
||||
@patch("toddlers.utils.pdc.set_pdc")
|
||||
@patch("toddlers.utils.pagure.set_pagure")
|
||||
@patch("toddlers.utils.fedora_account.set_fasjson")
|
||||
@patch("toddlers.utils.bugzilla_system.set_bz")
|
||||
def test_process(self, mock_bugzilla, mock_fasjson, mock_pagure, mock_pdc, toddler):
|
||||
def test_process(self, mock_bugzilla, mock_fasjson, mock_pagure, toddler):
|
||||
"""
|
||||
Assert that message toddler will be initialized correctly, if message passes
|
||||
initial processing.
|
||||
|
@ -222,7 +217,6 @@ class TestProcess:
|
|||
|
||||
mock_process_ticket.assert_called_with(issue)
|
||||
|
||||
mock_pdc.assert_called_with(config)
|
||||
mock_pagure.assert_has_calls(
|
||||
[
|
||||
call(config),
|
||||
|
@ -551,35 +545,6 @@ class TestVerifySLAs:
|
|||
with pytest.raises(ValidationError, match=error):
|
||||
self.toddler.verify_slas("", sla)
|
||||
|
||||
@patch("toddlers.utils.pdc.get_sla")
|
||||
def test_verify_slas_not_in_pdc(self, mock_pdc):
|
||||
"""
|
||||
Assert that the validation will fail if SLA is not in PDC.
|
||||
"""
|
||||
sla = {"rawhide": "2050-06-01"}
|
||||
|
||||
error = 'The SL "{0}" is not in PDC'.format("rawhide")
|
||||
|
||||
mock_pdc.return_value = None
|
||||
|
||||
with pytest.raises(ValidationError, match=error):
|
||||
self.toddler.verify_slas("", sla)
|
||||
|
||||
mock_pdc.assert_called_with("rawhide")
|
||||
|
||||
@patch("toddlers.utils.pdc.get_sla")
|
||||
def test_verify_slas_in_pdc(self, mock_pdc):
|
||||
"""
|
||||
Assert that the validation will pass if SLA is in PDC.
|
||||
"""
|
||||
sla = {"rawhide": "2050-06-01"}
|
||||
|
||||
mock_pdc.return_value = sla
|
||||
|
||||
self.toddler.verify_slas("", sla)
|
||||
|
||||
mock_pdc.assert_called_with("rawhide")
|
||||
|
||||
|
||||
class TestCreateNewRepo:
|
||||
"""
|
||||
|
@ -1140,8 +1105,7 @@ class TestCreateNewRepo:
|
|||
("modules", "rawhide"),
|
||||
],
|
||||
)
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_repo_namespaces(self, mock_pdc, namespace, branch):
|
||||
def test_create_new_repo_namespaces(self, namespace, branch):
|
||||
"""
|
||||
Assert that ticket will be processed when everything is in order and namespace is correct.
|
||||
"""
|
||||
|
@ -1194,14 +1158,6 @@ class TestCreateNewRepo:
|
|||
namespace, repo, "zlopez"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo, "{0}/{1}/{2}".format(dist_git_url, namespace, repo)
|
||||
)
|
||||
mock_pdc.new_branch.assert_called_with(repo, branch, namespace.rstrip("s"))
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, sls[branch], repo, branch, namespace.rstrip("s")
|
||||
)
|
||||
|
||||
message = "The Pagure repository was created at {0}/{1}/{2}".format(
|
||||
dist_git_url, namespace, repo
|
||||
)
|
||||
|
@ -1284,12 +1240,11 @@ class TestCreateNewRepo:
|
|||
)
|
||||
|
||||
@patch("toddlers.plugins.scm_request_processor.bugzilla_system")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
@patch(
|
||||
"toddlers.plugins.scm_request_processor.SCMRequestProcessor.validate_review_bug"
|
||||
)
|
||||
def test_create_new_repo_non_default_branch(
|
||||
self, mock_validate_review_bug, mock_pdc, mock_bz
|
||||
self, mock_validate_review_bug, mock_bz
|
||||
):
|
||||
"""
|
||||
Assert that ticket will be processed when everything is in order and requested
|
||||
|
@ -1339,22 +1294,6 @@ class TestCreateNewRepo:
|
|||
namespace, repo, "zlopez"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo, "{0}/{1}/{2}".format(dist_git_url, namespace, repo)
|
||||
)
|
||||
mock_pdc.new_branch.assert_has_calls(
|
||||
[
|
||||
call(repo, "rawhide", namespace.rstrip("s")),
|
||||
call(repo, branch, namespace.rstrip("s")),
|
||||
]
|
||||
)
|
||||
mock_pdc.new_sla_to_branch.assert_has_calls(
|
||||
[
|
||||
call("rawhide", "2050-06-01", repo, "rawhide", namespace.rstrip("s")),
|
||||
call(branch, sls[branch], repo, branch, namespace.rstrip("s")),
|
||||
]
|
||||
)
|
||||
|
||||
message = (
|
||||
"The Pagure repository was created at {0}/{1}/{2}. "
|
||||
'You may commit to the branch "{3}" in about '
|
||||
|
@ -1370,13 +1309,10 @@ class TestCreateNewRepo:
|
|||
mock_bz.change_bug_status.assert_called_with(bug_id, "RELEASE_PENDING", message)
|
||||
|
||||
@patch("toddlers.plugins.scm_request_processor.bugzilla_system")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
@patch(
|
||||
"toddlers.plugins.scm_request_processor.SCMRequestProcessor.validate_review_bug"
|
||||
)
|
||||
def test_create_new_repo_default_brach(
|
||||
self, mock_validate_review_bug, mock_pdc, mock_bz
|
||||
):
|
||||
def test_create_new_repo_default_brach(self, mock_validate_review_bug, mock_bz):
|
||||
"""
|
||||
Assert that repo will be created with default branch when everything is in order.
|
||||
"""
|
||||
|
@ -1423,14 +1359,6 @@ class TestCreateNewRepo:
|
|||
namespace, repo, "zlopez"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo, "{0}/{1}/{2}".format(dist_git_url, namespace, repo)
|
||||
)
|
||||
mock_pdc.new_branch.assert_called_with(repo, branch, namespace.rstrip("s"))
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, sls[branch], repo, branch, namespace.rstrip("s")
|
||||
)
|
||||
|
||||
message = "The Pagure repository was created at {0}/{1}/{2}".format(
|
||||
dist_git_url, namespace, repo
|
||||
)
|
||||
|
@ -1639,9 +1567,8 @@ class TestCreateNewBranch:
|
|||
@patch("toddlers.plugins.scm_request_processor.TemporaryDirectory")
|
||||
@patch("toddlers.plugins.scm_request_processor.git")
|
||||
@patch("toddlers.plugins.scm_request_processor.fedora_account")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_branch_default_branch_missing(
|
||||
self, mock_pdc, mock_fedora_account, mock_git, mock_temp_dir
|
||||
self, mock_fedora_account, mock_git, mock_temp_dir
|
||||
):
|
||||
"""
|
||||
Assert that ticket will be closed if there is no default branch in project,
|
||||
|
@ -1688,19 +1615,6 @@ class TestCreateNewBranch:
|
|||
mock_fedora_account.get_user_by_username(), "group"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo,
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
)
|
||||
|
||||
mock_pdc.new_branch.assert_called_with(
|
||||
repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, "2050-06-01", repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_git.clone_repo.assert_called_with(
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
"dir",
|
||||
|
@ -1720,9 +1634,8 @@ class TestCreateNewBranch:
|
|||
@patch("toddlers.plugins.scm_request_processor.TemporaryDirectory")
|
||||
@patch("toddlers.plugins.scm_request_processor.git")
|
||||
@patch("toddlers.plugins.scm_request_processor.fedora_account")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_branch_default_branch_missing_empty_repo(
|
||||
self, mock_pdc, mock_fedora_account, mock_git, mock_temp_dir
|
||||
self, mock_fedora_account, mock_git, mock_temp_dir
|
||||
):
|
||||
"""
|
||||
Assert that ticket will be closed if there is no default branch in project,
|
||||
|
@ -1769,28 +1682,11 @@ class TestCreateNewBranch:
|
|||
mock_fedora_account.get_user_by_username(), "group"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo,
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
)
|
||||
|
||||
mock_pdc.new_branch.assert_called_with(
|
||||
repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, "2050-06-01", repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_git.clone_repo.assert_called_with(
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
"dir",
|
||||
)
|
||||
|
||||
self.toddler.dist_git.get_default_branch.assert_called_with(namespace, repo)
|
||||
|
||||
ticket_text = (
|
||||
"The branch in PDC already exists, you can now create it yourself as follows:\n"
|
||||
"The branch couldn't be created in dist git. You can create it by yourself as "
|
||||
"follows:\n"
|
||||
"Check in the project's settings if you have activated the git hook preventing "
|
||||
"new git branches from being created and if you did, de-activate it.\n"
|
||||
"Then simply run in cloned repository: "
|
||||
|
@ -1809,9 +1705,8 @@ class TestCreateNewBranch:
|
|||
@patch("toddlers.plugins.scm_request_processor.TemporaryDirectory")
|
||||
@patch("toddlers.plugins.scm_request_processor.git")
|
||||
@patch("toddlers.plugins.scm_request_processor.fedora_account")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_branch_with_git(
|
||||
self, mock_pdc, mock_fedora_account, mock_git, mock_temp_dir
|
||||
self, mock_fedora_account, mock_git, mock_temp_dir
|
||||
):
|
||||
"""
|
||||
Assert that ticket will be processed and branch created in git.
|
||||
|
@ -1862,19 +1757,6 @@ class TestCreateNewBranch:
|
|||
mock_fedora_account.get_user_by_username(), "group"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo,
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
)
|
||||
|
||||
mock_pdc.new_branch.assert_called_with(
|
||||
repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
default_branch, "2050-06-01", repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_git.clone_repo.assert_called_with(
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
"dir",
|
||||
|
@ -1889,7 +1771,7 @@ class TestCreateNewBranch:
|
|||
)
|
||||
|
||||
message = (
|
||||
"The branch was created in PDC and git. It "
|
||||
"The branch was created in git. It "
|
||||
"may take up to 10 minutes before you have "
|
||||
"write access on the branch."
|
||||
)
|
||||
|
@ -1902,10 +1784,9 @@ class TestCreateNewBranch:
|
|||
)
|
||||
|
||||
@patch("toddlers.plugins.scm_request_processor.fedora_account")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_branch_only_PDC(self, mock_pdc, mock_fedora_account):
|
||||
def test_create_new_branch_create_git_branch_disabled(self, mock_fedora_account):
|
||||
"""
|
||||
Assert that ticket will be processed and branch created in PDC.
|
||||
Assert that ticket will be processed and branch not created.
|
||||
"""
|
||||
issue = {"id": 100, "user": {"name": "zlopez"}}
|
||||
|
||||
|
@ -1943,21 +1824,8 @@ class TestCreateNewBranch:
|
|||
mock_fedora_account.get_user_by_username(), "group"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo,
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
)
|
||||
|
||||
mock_pdc.new_branch.assert_called_with(
|
||||
repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, "2050-06-01", repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
message = (
|
||||
"The branch in PDC was created. Pagure is still processing "
|
||||
"Pagure is still processing "
|
||||
"the request, but in about 10 minutes, you may create the "
|
||||
"branch in Pagure using git."
|
||||
)
|
||||
|
@ -1971,10 +1839,7 @@ class TestCreateNewBranch:
|
|||
|
||||
@patch("toddlers.plugins.scm_request_processor.bugzilla_system")
|
||||
@patch("toddlers.plugins.scm_request_processor.fedora_account")
|
||||
@patch("toddlers.plugins.scm_request_processor.pdc")
|
||||
def test_create_new_branch_comment_on_bug(
|
||||
self, mock_pdc, mock_fedora_account, mock_bz
|
||||
):
|
||||
def test_create_new_branch_comment_on_bug(self, mock_fedora_account, mock_bz):
|
||||
"""
|
||||
Assert that ticket will be processed and comment added to bugzilla bug, if provided.
|
||||
"""
|
||||
|
@ -2016,21 +1881,8 @@ class TestCreateNewBranch:
|
|||
mock_fedora_account.get_user_by_username(), "group"
|
||||
)
|
||||
|
||||
mock_pdc.new_global_component.assert_called_with(
|
||||
repo,
|
||||
"{0}/{1}/{2}".format(self.toddler.dist_git._pagure_url, namespace, repo),
|
||||
)
|
||||
|
||||
mock_pdc.new_branch.assert_called_with(
|
||||
repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
mock_pdc.new_sla_to_branch.assert_called_with(
|
||||
branch, "2050-06-01", repo, branch, namespace.strip().rstrip("s")
|
||||
)
|
||||
|
||||
message = (
|
||||
"The branch in PDC was created. Pagure is still processing "
|
||||
"Pagure is still processing "
|
||||
"the request, but in about 10 minutes, you may create the "
|
||||
"branch in Pagure using git."
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ import toml
|
|||
|
||||
from toddlers.base import ToddlerBase
|
||||
from toddlers.exceptions import ValidationError
|
||||
from toddlers.utils import bugzilla_system, fedora_account, git, pagure, pdc, requests
|
||||
from toddlers.utils import bugzilla_system, fedora_account, git, pagure, requests
|
||||
|
||||
# Regex for branch name validation
|
||||
STREAM_NAME_REGEX = r"^[a-zA-Z0-9.\-_+]+$"
|
||||
|
@ -46,15 +46,6 @@ INVALID_EPEL_ERROR = (
|
|||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
# Currently there is no way to generate PDC API token on either
|
||||
# pdc.stg.fedoraproject.org or pdc.fedoraproject.org
|
||||
# So let's keep this here to be able to at least mock pdc calls
|
||||
# when testing.
|
||||
# When using this comment out the pdc.set_pdc line in process method
|
||||
# from unittest.mock import Mock
|
||||
# pdc = Mock()
|
||||
# pdc.get_branch.return_value = None
|
||||
|
||||
|
||||
class SCMRequestProcessor(ToddlerBase):
|
||||
"""
|
||||
|
@ -178,9 +169,6 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
)
|
||||
return
|
||||
|
||||
_log.info("Setting up PDC client")
|
||||
pdc.set_pdc(config)
|
||||
|
||||
_log.info("Setting up connection to Pagure")
|
||||
self.pagure_io = pagure.set_pagure(config)
|
||||
|
||||
|
@ -321,7 +309,7 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
|
||||
def verify_slas(self, branch: str, sla_dict: dict):
|
||||
"""
|
||||
Verifies that SLAs are properly formatted and exist in PDC
|
||||
Verifies that SLAs are properly formatted
|
||||
|
||||
Params:
|
||||
branch: a string of the branch name to verify or None
|
||||
|
@ -364,10 +352,6 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
'The SL "{0}" must expire on June 1st or December 1st'.format(eol)
|
||||
)
|
||||
|
||||
sla_obj = pdc.get_sla(sla)
|
||||
if not sla_obj:
|
||||
raise ValidationError('The SL "{0}" is not in PDC'.format(sla))
|
||||
|
||||
def create_new_repo(
|
||||
self, issue: dict, issue_body_json: dict, initial_commit: bool = True
|
||||
):
|
||||
|
@ -546,8 +530,6 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
|
||||
description = issue_body_json.get("description", "").strip()
|
||||
upstreamurl = issue_body_json.get("upstreamurl", "").strip()
|
||||
# Convert a component type to it's singular form
|
||||
component_type = namespace.strip().rstrip("s")
|
||||
# Close the ticket if the requested default branch is master
|
||||
if branch_name == "master":
|
||||
self.pagure_io.close_issue(
|
||||
|
@ -581,43 +563,11 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
return
|
||||
|
||||
_log.info("Ticket passed all validations. Creating repository.")
|
||||
# Create the PDC SLA entry
|
||||
|
||||
# Create the Pagure repo
|
||||
dist_git_url = "{0}/{1}/{2}".format(
|
||||
self.dist_git._pagure_url.rstrip("/"), namespace, repo
|
||||
)
|
||||
# If the global component already exists, this will not create another
|
||||
# Skip for tests namespace
|
||||
if namespace != "tests":
|
||||
_log.debug("Creating repo '{0}' in PDC".format(repo))
|
||||
pdc.new_global_component(repo, dist_git_url)
|
||||
# If the branch requested isn't default branch, still create a default branch
|
||||
# in PDC anyways.
|
||||
# Skip pdc magic for tests namespace
|
||||
if namespace != "tests":
|
||||
if branch_name != default_branch:
|
||||
_log.debug("Creating branch '{0}' in PDC".format(default_branch))
|
||||
pdc.new_branch(repo, default_branch, component_type)
|
||||
for sla, eol in self.branch_slas[default_branch].items():
|
||||
_log.debug(
|
||||
"Adding SLA {0}:{1} to branch '{2}' in PDC".format(
|
||||
sla, eol, default_branch
|
||||
)
|
||||
)
|
||||
pdc.new_sla_to_branch(
|
||||
sla, eol, repo, default_branch, component_type
|
||||
)
|
||||
|
||||
_log.debug("Creating branch '{0}' in PDC".format(branch_name))
|
||||
pdc.new_branch(repo, branch_name, component_type)
|
||||
for sla, eol in issue_body_json["sls"].items():
|
||||
_log.debug(
|
||||
"Adding SLA {0}:{1} to branch '{2}' in PDC".format(
|
||||
sla, eol, branch_name
|
||||
)
|
||||
)
|
||||
pdc.new_sla_to_branch(sla, eol, repo, branch_name, component_type)
|
||||
|
||||
# Create the Pagure repo
|
||||
_log.debug("Creating a repo '{0}' in dist-git".format(repo))
|
||||
self.dist_git.new_project(
|
||||
namespace,
|
||||
|
@ -719,9 +669,6 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
reason="Invalid",
|
||||
)
|
||||
return
|
||||
# Pagure uses plural names for namespaces, but PDC does not use the
|
||||
# plural version for branch types
|
||||
branch_type = namespace.strip().rstrip("s")
|
||||
issue_owner = issue["user"]["name"]
|
||||
|
||||
# Check if the branch requestor is one of the maintainers or part of the groups
|
||||
|
@ -773,28 +720,19 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
return
|
||||
|
||||
_log.info("Ticket passed all validations. Creating branch in repository.")
|
||||
# Create the PDC entry
|
||||
dist_git_url = "{0}/{1}/{2}".format(
|
||||
self.dist_git._pagure_url.rstrip("/"), namespace, repo
|
||||
)
|
||||
# If the global component already exists, this will not try to create
|
||||
# it
|
||||
pdc.new_global_component(repo, dist_git_url)
|
||||
|
||||
pdc.new_branch(repo, branch_name, branch_type)
|
||||
for sla, eol in issue_body_json["sls"].items():
|
||||
_log.debug("Adding '{}':'{}' to branch '{}'".format(sla, eol, branch_name))
|
||||
pdc.new_sla_to_branch(sla, eol, repo, branch_name, branch_type)
|
||||
|
||||
if create_git_branch:
|
||||
with TemporaryDirectory(dir=self.temp_dir) as tmp_dir:
|
||||
dist_git_url = "{0}/{1}/{2}".format(
|
||||
self.dist_git._pagure_url.rstrip("/"), namespace, repo
|
||||
)
|
||||
git_repo = git.clone_repo(dist_git_url, tmp_dir)
|
||||
default_branch = self.dist_git.get_default_branch(namespace, repo)
|
||||
if not default_branch:
|
||||
# This is a new repo without any branch
|
||||
if not branches:
|
||||
ticket_text = (
|
||||
"The branch in PDC already exists, you can now create it "
|
||||
"The branch couldn't be created in dist git. You can create it by "
|
||||
"yourself as follows:\n"
|
||||
"Check in the project's settings if you have activated "
|
||||
"the git hook preventing "
|
||||
|
@ -829,13 +767,13 @@ class SCMRequestProcessor(ToddlerBase):
|
|||
namespace, repo, branch_name, from_commit=commit
|
||||
)
|
||||
new_branch_comment = (
|
||||
"The branch was created in PDC and git. It "
|
||||
"The branch was created in git. It "
|
||||
"may take up to 10 minutes before you have "
|
||||
"write access on the branch."
|
||||
)
|
||||
else:
|
||||
new_branch_comment = (
|
||||
"The branch in PDC was created. Pagure is still processing "
|
||||
"Pagure is still processing "
|
||||
"the request, but in about 10 minutes, you may create the "
|
||||
"branch in Pagure using git."
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue