bugfix: uso base para generar contenido del PR y muestro mensajes de exito
This commit is contained in:
@@ -17,15 +17,16 @@ class MergeCommand(Command):
|
|||||||
|
|
||||||
branch = self.ensure_right_branch()
|
branch = self.ensure_right_branch()
|
||||||
(target, _) = self.get_branch_env_and_type(branch)
|
(target, _) = self.get_branch_env_and_type(branch)
|
||||||
|
base = Git.get_first_fork_point(branch, target)
|
||||||
|
|
||||||
if "flow.remote" in self.flowconfig:
|
if "flow.remote" in self.flowconfig:
|
||||||
remote = self.flowconfig["flow.remote"]
|
remote = self.flowconfig["flow.remote"]
|
||||||
token = self.ensure_repository_token()
|
token = self.ensure_repository_token()
|
||||||
self.run_remote(remote, token, branch, target)
|
self.run_remote(remote, token, base, branch, target)
|
||||||
else:
|
else:
|
||||||
self.run_local(branch, target)
|
self.run_local(base, branch, target)
|
||||||
|
|
||||||
def run_remote(self, remote: str, token: str, branch: str, target: str):
|
def run_remote(self, remote: str, token: str, base: str, branch: str, target: str):
|
||||||
self.check_pending_changes(True)
|
self.check_pending_changes(True)
|
||||||
|
|
||||||
Git("switch", target).exec()
|
Git("switch", target).exec()
|
||||||
@@ -33,16 +34,16 @@ class MergeCommand(Command):
|
|||||||
Git("switch", "-").exec()
|
Git("switch", "-").exec()
|
||||||
|
|
||||||
self.check_merge_conflicts(target)
|
self.check_merge_conflicts(target)
|
||||||
self.show_commits_to_merge(branch, target)
|
self.show_commits_to_merge(base)
|
||||||
|
|
||||||
Git("push", remote, branch, set_upstream=True).exec()
|
Git("push", remote, branch, set_upstream=True).exec()
|
||||||
|
|
||||||
self.create_pull_request(token, branch, target)
|
self.create_pull_request(token, base, branch, target)
|
||||||
|
|
||||||
def run_local(self, branch: str, target: str):
|
def run_local(self, base: str, branch: str, target: str):
|
||||||
self.check_pending_changes(False)
|
self.check_pending_changes(False)
|
||||||
self.check_merge_conflicts(target)
|
self.check_merge_conflicts(target)
|
||||||
self.show_commits_to_merge(branch, target)
|
self.show_commits_to_merge(base)
|
||||||
|
|
||||||
if self.confirm(f"Mergear rama '{target}' <= '{branch}'?"):
|
if self.confirm(f"Mergear rama '{target}' <= '{branch}'?"):
|
||||||
Git("switch", target).exec()
|
Git("switch", target).exec()
|
||||||
@@ -65,8 +66,7 @@ class MergeCommand(Command):
|
|||||||
if not self.confirm("¿Desea continuar?", False):
|
if not self.confirm("¿Desea continuar?", False):
|
||||||
raise GitFlowError("Ejecución abortada")
|
raise GitFlowError("Ejecución abortada")
|
||||||
|
|
||||||
def show_commits_to_merge(self, branch: str, target: str):
|
def show_commits_to_merge(self, base):
|
||||||
base = Git.get_first_fork_point(branch, target)
|
|
||||||
commits = Git("log", base + "..", format="%s").lines()
|
commits = Git("log", base + "..", format="%s").lines()
|
||||||
|
|
||||||
if not commits:
|
if not commits:
|
||||||
@@ -90,12 +90,14 @@ class MergeCommand(Command):
|
|||||||
else:
|
else:
|
||||||
self.success("No se detectaron merge conflicts.")
|
self.success("No se detectaron merge conflicts.")
|
||||||
|
|
||||||
def create_pull_request(self, token: str, branch: str, target: str):
|
def create_pull_request(self, token: str, base: str, branch: str, target: str):
|
||||||
changelog = Changelog()
|
changelog = Changelog()
|
||||||
|
|
||||||
self.get_remote_api(token).create_pull_request(
|
message = self.get_remote_api(token).create_pull_request(
|
||||||
branch,
|
branch,
|
||||||
target,
|
target,
|
||||||
branch.replace("/", ": ").replace("-", " "),
|
branch.replace("/", ": ").replace("-", " "),
|
||||||
changelog.generate_content(branch, target),
|
changelog.generate_content(base, branch),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.success(message)
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ class TagCommand(Command):
|
|||||||
(token, ci) = self.get_token_and_ci(args)
|
(token, ci) = self.get_token_and_ci(args)
|
||||||
|
|
||||||
if ci:
|
if ci:
|
||||||
self.get_remote_api(token).create_tag(next_tag, merge_commit)
|
message = self.get_remote_api(token).create_tag(next_tag, merge_commit)
|
||||||
changelog = Changelog()
|
changelog = Changelog()
|
||||||
|
|
||||||
|
self.success(message)
|
||||||
changelog.update(next_tag, base, branch)
|
changelog.update(next_tag, base, branch)
|
||||||
Git("add", Changelog.FILENAME).exec()
|
Git("add", Changelog.FILENAME).exec()
|
||||||
Git("commit", message=Changelog.COMMIT_MESSAGE).exec()
|
Git("commit", message=Changelog.COMMIT_MESSAGE).exec()
|
||||||
|
|||||||
Reference in New Issue
Block a user