I am using gerrit 2.14 and am wondering if there is a way to stop the change from getting merged from the "change-merged" hook? does "change-merged" hook run only after a change is merged?
With the exception of the commit-received and ref-update hooks, hooks are run in the background after the relevant change has taken place so are unable to affect the outcome of any given change. Because of the fact the hooks are run in the background after the activity, a hook might not be notified about an event if the server is shutdown before the hook can be invoked.
submit
This is called when a user attempts to submit a change. It allows the submit to be rejected.
If the hook exits with non-zero return code the submit will be rejected and the ouput from the hook will be returned to the user.
@Martin:There could be other ways to do it but thats not what I am looking for,am looking do it through gerrit hooks rather than building a whole new system,I dont want to side-track this discussionI want to know if there is a way to stop the change from getting merged from the "change-merged" hook? I want to stick to this dicussion
On Wednesday, February 20, 2019 at 4:11:48 PM UTC-8, MartinFick wrote:On Wednesday, February 20, 2019 3:11:30 PM MST William wrote:
> @Gert:
>
> I have the info you mentioned ,thats why I specifically asked if the submit
> can be rejected from the "change-merged" hook
>
> My use case is that from my change-merged hook I cherry-pick the change
> being MERGED to other branches but the cherry-picked changes end up in
> merge conflicts and developers don't resolve them in a timely manner, so to
> be able to force developers to resolve the merge conflicts I want to make
> use of "topic" field to do atomic merge (ALL or NOTHING gets MERGED)
> including the original gerrit being MERGED, basically block the original
> change from being MERGED
>
>
> So, for my use case I need to be able to reject merging(submiting) a change
> from the "change-merged" hook (I know I can do it from other hooks like
> "submit" but there is no "submit" hook in gerrit 2.14 ) .
I suspect that what you are trying to achieve is better done via a CI system
that can check if there is an existing change for each branch you care about,
and whether that change can currently be merged to that branch. Once all the
changes pass, you can give the change a V+1, else V-1.
-Martin
--
The Qualcomm Innovation Center, Inc. is a member of Code
Aurora Forum, hosted by The Linux Foundation
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have the info you mentioned ,thats why I specifically asked if the submit can be rejected from the "change-merged" hookMy use case is that from my change-merged hook I cherry-pick the change being MERGED to other branches but the cherry-picked changes end up in merge conflicts and developers don't resolve them in a timely manner, so to be able to force developers to resolve the merge conflicts I want to make use of "topic" field to do atomic merge (ALL or NOTHING gets MERGED) including the original gerrit being MERGED, basically block the original change from being MERGED
So, for my use case I need to be able to reject merging(submiting) a change from the "change-merged" hook (I know I can do it from other hooks like "submit" but there is no "submit" hook in gerrit 2.14 ) .
@Gert:I would like to ask why you suggest using a ":A CI or CI-like script " ,why not gerrit hooks? I know you mentioned not to block all submissions but I want to get more details on when would it mandate a CI system(Script) as opposed to doing it in gerrit hooks outside of the problem at hand,I have been trying to find a justifiable answer for this for long on why to build a seperate CI system when we can use Gerrit hooks to do the job