Unverified Commit 48a78e78 authored by Jonah Brüchert's avatar Jonah Brüchert
Browse files

Add warning when not using a work branch on kde infrastructure

parent f752f37c
......@@ -50,6 +50,7 @@ def run(args: argparse.Namespace) -> None:
:param args: parsed arguments
"""
creator: MergeRequestCreator = MergeRequestCreator(args.target_branch)
creator.check(args.fork)
if args.fork:
creator.fork()
......@@ -72,6 +73,25 @@ class MergeRequestCreator(RepositoryConnection):
RepositoryConnection.__init__(self)
self.__target_branch = target_branch
def check(self, fork: bool) -> None:
"""
Run some sanity checks and warn the user if necessary
"""
if (
not self.local_repo().active_branch.name.startswith("work/")
and not fork
and "invent.kde.org" in self.connection().url
):
Utils.log(
LogType.Warning,
"Pushing to the upstream repository, but the branch name doesn't start with work/.",
)
print(
"This is not recommended on KDE infrastructure,",
"as it doesn't allow to rebase or force-push the branch.",
"To cancel, please press Ctrl + C.",
)
def fork(self) -> None:
"""
Try to create a fork of the remote repository.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment