Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to prevent updates to pull request

Harish August 5, 2015

Is there any plugin to control the updates to an open pull request? Once the requester has submitted the pull request for a branch, they should not be able to update it. Either the pull request is to be automatically denied or should prevent updates to the branch.

4 answers

4 votes
Mark McCormack (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2015

As well as the plugin Balazs suggested, there is another Add-on you will likely find useful called ScriptRunner for Stash.

You can read the documentation about the functionality, ScriptRunner for Stash too can withdraw approvals whenever a Pull Request changes.

It also gives you the ability to control a number potentially undesired events as a Pre-Hook (i.e before the git push is successful).

There is a short video available about the typical Pre-Hooks you might use so you can quickly assess if you might find it useful. The other functionality you will likely find useful is the Auto Add Reviewers to Pull Requests video.

I hope it helps.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2015

This sounds like a) overkill for the task at hand (both in price and complexity) and b) an advertisement for your product rather than an actual answer to the question.

Mark McCormack (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2015

Balazs, thanks for your comment. a) I thought I'd give Harish the information. b) yes, it is an advert with the intent of helping at the same time. Perhaps next time I will stick to answering the question and not throw in extra features.

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2015

In general, pull requests have to be updateable, otherwise it would be impossible to fix problems with the code changes discovered during review. To make sure that only the approved changes actually get merged, you can do either of these:

  • Have the reviewer merge the PR, right after approving it
  • Install this plugin and then in the pull request settings of the repo:
    • set "Requires N approvers" to 1 (or more) and enable it
    • also enable "Unapprove all reviewers when the source branch of a pull request changes"

N.B. In both of these cases, it is still possible to remotely merge(*) the pull request with unapproved changes, as long as the author has write access to the target branch.

(*) Merge the source branch to the target in a Git client and push the merge commit.

0 votes
Harish August 5, 2015

In a sense that when the requester has sent me a request to merge, the branch is considered to be finished and ready there should be no more updates to it. Let us say that the approver has approved the request, in the time between approving and merging , any more updates should not be accepted.

0 votes
Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2015

Why? That appears not productive to me. There is a plugin to automatically unapproved on updates, I find that more useful.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events