Page MenuHomePhabricator

Add Herald support for blocking ref changes
ClosedPublic

Authored by epriestley on Dec 17 2013, 10:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 4:24 AM
Unknown Object (File)
Sat, Dec 7, 9:36 PM
Unknown Object (File)
Nov 24 2024, 6:47 PM
Unknown Object (File)
Nov 21 2024, 8:50 AM
Unknown Object (File)
Nov 20 2024, 3:24 AM
Unknown Object (File)
Nov 16 2024, 7:28 AM
Unknown Object (File)
Nov 12 2024, 1:04 PM
Unknown Object (File)
Nov 8 2024, 2:03 AM
Subscribers

Details

Summary

Ref T4195. Allows users to write Herald rules which block ref changes. For example, you can write a rule like alincoln can not create branches, or no one can push to the branch "frozen".

Test Plan

This covers a lot of ground. I created and pushed a bunch of rules, then looked at transcripts, in general. Here are some bits in detail:

Here's a hook-based reject message:

>>> orbital ~/repos/POEMS $ git push
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 274 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: +---------------------------------------------------------------+
remote: |      * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * *     |
remote: +---------------------------------------------------------------+
remote:             \
remote:              \                    ^    /^
remote:               \                  / \  // \
remote:                \   |\___/|      /   \//  .\
remote:                 \  /V  V  \__  /    //  | \ \           *----*
remote:                   /     /  \/_/    //   |  \  \          \   |
remote:                   @___@`    \/_   //    |   \   \         \/\ \
remote:                  0/0/|       \/_ //     |    \    \         \  \
remote:              0/0/0/0/|        \///      |     \     \       |  |
remote:           0/0/0/0/0/_|_ /   (  //       |      \     _\     |  /
remote:        0/0/0/0/0/0/`/,_ _ _/  ) ; -.    |    _ _\.-~       /   /
remote:                    ,-}        _      *-.|.-~-.           .~    ~
remote:   \     \__/        `/\      /                 ~-. _ .-~      /
remote:    \____(Oo)           *.   }            {                   /
remote:    (    (--)          .----~-.\        \-`                 .~
remote:    //__\\  \ DENIED!  ///.----..<        \             _ -~
remote:   //    \\               ///-._ _ _ _ _ _ _{^ - - - - ~
remote: 
remote: 
remote: This commit was rejected by Herald pre-commit rule H24.
remote: Rule: No Branches Called Blarp
remote: Reason: "blarp" is a bad branch name
remote: 
To ssh://dweller@localhost/diffusion/POEMS/
 ! [remote rejected] blarp -> blarp (pre-receive hook declined)
error: failed to push some refs to 'ssh://dweller@localhost/diffusion/POEMS/'

Here's a transcript, showing that all the field values populate sensibly:

{F90453}

Here's a rule:

{F90454}

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Oops, here's a much better transcript:

{F90457}

Here are some push logs with rejection code 2 (Herald):

{F90460}

This is great, I especially like that you can specify a reason in the rule, and how that shows up in the commit hook.