diff --git a/src/git_flow/command/merge.py b/src/git_flow/command/merge.py index 7fef819..70d8f79 100644 --- a/src/git_flow/command/merge.py +++ b/src/git_flow/command/merge.py @@ -17,15 +17,16 @@ class MergeCommand(Command): branch = self.ensure_right_branch() (target, _) = self.get_branch_env_and_type(branch) + base = Git.get_first_fork_point(branch, target) if "flow.remote" in self.flowconfig: remote = self.flowconfig["flow.remote"] token = self.ensure_repository_token() - self.run_remote(remote, token, branch, target) + self.run_remote(remote, token, base, branch, target) 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) Git("switch", target).exec() @@ -33,16 +34,16 @@ class MergeCommand(Command): Git("switch", "-").exec() 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() - 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_merge_conflicts(target) - self.show_commits_to_merge(branch, target) + self.show_commits_to_merge(base) if self.confirm(f"Mergear rama '{target}' <= '{branch}'?"): Git("switch", target).exec() @@ -65,8 +66,7 @@ class MergeCommand(Command): if not self.confirm("¿Desea continuar?", False): raise GitFlowError("Ejecución abortada") - def show_commits_to_merge(self, branch: str, target: str): - base = Git.get_first_fork_point(branch, target) + def show_commits_to_merge(self, base): commits = Git("log", base + "..", format="%s").lines() if not commits: @@ -90,12 +90,14 @@ class MergeCommand(Command): else: 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() - self.get_remote_api(token).create_pull_request( + message = self.get_remote_api(token).create_pull_request( branch, target, branch.replace("/", ": ").replace("-", " "), - changelog.generate_content(branch, target), + changelog.generate_content(base, branch), ) + + self.success(message) diff --git a/src/git_flow/command/tag.py b/src/git_flow/command/tag.py index 1d755ed..53b4fdf 100644 --- a/src/git_flow/command/tag.py +++ b/src/git_flow/command/tag.py @@ -46,9 +46,10 @@ class TagCommand(Command): (token, ci) = self.get_token_and_ci(args) 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() + self.success(message) changelog.update(next_tag, base, branch) Git("add", Changelog.FILENAME).exec() Git("commit", message=Changelog.COMMIT_MESSAGE).exec()