diff --git a/src/git_flow/command/merge.py b/src/git_flow/command/merge.py index 683d732..ff2f17b 100644 --- a/src/git_flow/command/merge.py +++ b/src/git_flow/command/merge.py @@ -80,16 +80,27 @@ class MergeCommand(Command): def create_pull_request(self, token: str, branch: str, target: str): changelog = Changelog() - title = self.prompt("[Opcional] Ingrese un titulo para el PR") - title = title or branch.replace("/", ": ").replace("-", " ") + commits = Git("log", target + "..", format="%s").lines() - if title.startswith("release: "): - title = title[title.index(' ', title.index(' ') + 1) + 1:] + if len(commits) == 1: + title = commits[0] + else: + title = branch.replace("/", ": ").replace("-", " ") + + if title.startswith("release: "): + title = title[title.index(' ', title.index(' ') + 1) + 1:] + + self.info("Título del PR por defecto: " + title) + + opt_title = self.prompt("[Opcional] Ingrese otro titulo para el PR") + + if opt_title: + title = opt_title message = self.get_remote_api(token).create_pull_request( branch, target, - branch.replace("/", ": ").replace("-", " "), + title, changelog.generate_content(target, branch), ) diff --git a/src/git_flow/command/new.py b/src/git_flow/command/new.py index 4ed6233..18a91ec 100644 --- a/src/git_flow/command/new.py +++ b/src/git_flow/command/new.py @@ -44,9 +44,6 @@ class NewCommand(Command): persistent=True, ) - ticket = self.prompt("[Opcional] Ingrese el ID del ticket (por ejemplo ABC-123 o #123)") - ticket = ticket[1:] if ticket.startswith("#") else ticket - keywords = ticket + ' ' + keywords keywords = filter(lambda k: len(k) > 0, keywords.split(" ")) branch = branch_type + "/" + "-".join(keywords) diff --git a/src/git_flow/command/release.py b/src/git_flow/command/release.py index 2988818..9c43e40 100644 --- a/src/git_flow/command/release.py +++ b/src/git_flow/command/release.py @@ -55,9 +55,11 @@ class ReleaseCommand(Command): print("- " + commit) group = args.group + grouping = group is not None - if not group: + if not grouping: if self.confirm("¿Desea agrupar este release con otra rama?", False): + grouping = True group = self.choice("Grupo release: ", Git.get_branches("release/" + next_env + "/")) else: group = next_env @@ -89,6 +91,15 @@ class ReleaseCommand(Command): else: Git("switch", next_branch, create=True).exec(print="Creando rama release") - Git("rebase", base, next_branch, onto=group).exec( + status = Git("rebase", base, next_branch, onto=group).code( print="Moviendo cambios hacia el siguiente ambiente" ) + + if status: + Git("rebase", abort=True).exec( + print="Deshaciendo cambios por conflictos" + ) + raise GitFlowError("Error al realizar pasaje de cambios a rama objetivo") + elif grouping: + Git("switch", group).exec(print="Cambiando a rama objetivo") + Git("merge", next_branch, ff_only=True).exec(print="Mergeando cambios de la nueva rama")