Actions
Feature #5584
open"update pull request link" message on vcs client
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
20.01.2020
Due date:
% Done:
0%
Estimated time:
Sorting:
Commit Number:
Description
On commit push, RhodeCode prints "RhodeCode: open pull request link " on the vcs client output, with a URL to create a PR sith the branch name. When there is already a PR with this branch as a source, what the user need instead is a link to update the pull request.
It's possible to do that using rcextensions, but it does not replace the "open pull request" message, it just adds to it.
from .utils import DotDict, HookResponse
from rhodecode.model.db import Repository
from rhodecode.model.pull_request import PullRequestModel
def _updateable_pull_requests_messages(*args, **kwargs):
dotargs = DotDict.fromDict(kwargs)
resp = HookResponse(0, '')
repo = Repository.get_by_repo_name(dotargs.repository)
branches_pushed = {repo.get_changeset(commit).branch for commit in dotargs.commit_ids}
for pr in repo.pull_requests_source:
if pr.status == 'closed':
continue
pr_source_branch = pr.source_ref_parts.name
if pr_source_branch in branches_pushed:
link = PullRequestModel().get_url(pr)
msg = 'RhodeCode: update pull request link: {}\n'.format(link)
resp += HookResponse(0, msg)
return resp
Updated by Marcin Kuzminski [CTO] over 4 years ago
Thanks for the idea, i think it's a nice workaround, but this would work only for Mercurial repositories in the current state.
We have an auto-updatable PRs on our roadmap and will implement that soon in the core. Since it's going to be based probably on automation scheduler, we can implement things like auto-merge once approved etc.
Actions