There is a possibility that a user can add commit to accepted diff and then can push into main repository. I've a herald rule which prevents unaccepted revisions to get pushed into repository. But by tailgating commits into accepted diff, someone can push those commits into main repository directly.
Is there any way by which I can write a global rule to automatically trigger "request review" for updated revisions?
Please read comments on the answer of @avivey, that discussion led to reopening of this question.
The option is called "differential.sticky-accept":
Normally, when revisions that have been "Accepted" are updated, they remain "Accepted". This allows reviewers to suggest minor alterations when accepting, and encourages authors to update if they make minor changes in response to this feedback.
If you want updates to always require re-review, you can disable the "stickiness" of the "Accepted" status with this option. This may make the process for minor changes much more burdensome to both authors and reviewers.
For more background, see https://secure.phabricator.com/book/phabricator/article/differential_faq/#why-does-an-accepted-rev.
err... Not exactly.
Differential doesn't use "commit" as a unit; The basic unit of change is "Diff", and a Revision has exactly one Active Diff. The commits information is ignored.
Amending existing commits vs creating new commits have no effect on the resulting behavior of Differential.
So in either case, if the content of the revision is changed, the Accept state will be reverted, and it will require another review.
I tested this and this led to an interesting result. (sticky-accept) is false
- I've a herald rule enabled which blocks non-accepted revision to be pushed.
- I created an arc diff
- I tried to push my commit - It is blocked by herald rule
- Reviewer accepted my revision
- I changed something in my commit and amended it. Pushing into repository worked fine (it was not blocked)
- I created another arc diff which was accepted by reviewer
- Created a git commit and updated revision by arc diff. Revision status was changed to Need review (push is blocked at this point of time)
- Reviewer again accepted the new changes
- Push works fine
If instead of point 9, I change my code and do a commit-amend, it is again blocked by herald rule even though that commit was the part of accepted revision. arc diff and re-accepting the revision was working normally.
This is my herald rule description:
Rule Type Global
Applies To Commit Hook: Commit Content
When all of these conditions are met:
Accepted Differential revision does not exist
Take these actions every time this rule matches:
Block push with message: Unreviewed code is not allowed!