Page MenuHomePhabricator

Implement pre-commit Herald rules
Closed, ResolvedPublic

Description

See discussion in T4189.

I think I'm going to do this in two hook phases. The first phase is the "ref" phase and controls adding, changing, and removing tags, branches and bookmarks. The fields would be things like:

[New tags] [exist]
[Modified branches] [include] [master]
[Modified branches] [match regexp] [/whatever/]
[Deleted bookmarks] [include] [quack]
[Repository] [is] [rP]
[Pusher] [is] [alincoln]

The only action is "reject with message":

[Reject with message] ["Interns aren't allowed to touch master."]

This phase can't examine commit content, but can encode a bunch of rules like who can push to master, who can create or delete tags or branches, etc. This phase doesn't fire in Subversion, since there are no meaningful ref-like metadata artifacts.

The second phase is the "commit" phase and looks very similar to the existing commit hooks. It has fields like:

[Commit message] ...
[Affected files] ...
[Author] ...

...etc. It will have a few new special rules, like:

[Committer]
[Commit is new branch head?]
[Commit is merge?]
[Commit branches]

This permits all the content-based rules to fire.

I think this will cover the vast majority of cases. One issue is that putting all of this in Herald global rules means you may automatically have rules apply to repositories you create and be unable to edit them (e.g., if all users can create repositories but only admins can manage global rules). But this is good in the common case where you have multiple similar repositories, and I think we can wait and see if it's a problem in practice. Additional changes in the future (like tagging repositories with projects) should make it easier to write rules that don't step on anyone's toes, even for larger organizations.

Details

Commits
D7841 / rP9f38aaa5dec4: Add "raw author name" and "raw committer name" as Herald fields for commit…
D7820 / rPadcc4ee1db1d: Add a "branches" rule for Herald commit rules
D7809 / rPa64d127e2569: Add "is merge commit" Herald field for pre-commit rules
D7808 / rP9c938701c3dd: Modernize Diffusion `commitparentsquery`
D7807 / rP72c73d644b0e: Add an "Accepted Differential revision" field to Commit and pre-commit Content…
D7806 / rP2436458b903c: Implement "Differential Revision" fields in Herald pre-commit content adapter
D7805 / rPd7c4edab28a4: Move commit message/metadata field query to a separate class
D7804 / rP23332241b20e: Move commit hash querying to DiffusionLowLevelCommitQuery
D7801 / rPd667b1220662: Provide a standalone query for resolution of commit author/committer into…
D7802 / rP134c8f554763: Add "Author" and "Committer" fields to Herald pre-commit content hooks
D7800 / rPf750d5f8dc91: Provide a low-level SVN commit query, and merge the VCS query types
D7796 / rP151f01ae9477: Implement "Body" field in Herald pre-commit content hooks
D7795 / rP92bc76aae053: Move mercurial commit metadata parsing into a LowLevel query
D7793 / rPf048053c7586: Move git commit metadata parsing into a LowLevelQuery
D7790 / rARC8e177c4db8d1: Parse the output of `svnlook diff ...`
D7792 / rPd90f44ef2058: Support content pre-commit hooks in Mercurial
D7791 / rP5f4df0f3e394: Support "changed filename" and "file content" fields for commit content Herald…
D7789 / rPe115f11f8049: Provide basic commit content hooks for Herald
D7782 / rP3386920971b8: Add Herald support for blocking ref changes
D7781 / rPbaa756a027fa: Add `rulePHID` to HeraldEffect
D7780 / rPf28d3089d7d8: Assign PHIDs to PushLogs
D7766 / rP2216a5e6efb9: Add Subversion ref and content logs to pre-commit hooks
D7765 / rP11b8e57ae012: Remove "pretag" hook support in Mercurial
D7764 / rP74251b363675: Support bookmark hook operations in Mercurial
D7763 / rP6f3a99eb392e: Generate ref updates in Mercurial hooks
D7761 / rP2725586bafa0: Restructure HookEngine to use PushLog records for all operations
D7762 / rPHU73367c774eb7: Add updateEnv() to ExecFuture for adjusting environmental variables
D7718 / rP2ff5541fc59c: Record new commits in the push log
D7713 / rP3f5046014948: Allow repository push logs to be filtered by pusher and repository
D7711 / rPe28b848ab2fb: Store pusher remote address and push protocol in PushLog
D7705 / rPcaa6fdf56dc2: Add a basic push log for recording repository push events

Event Timeline

epriestley claimed this task.
epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added a project: Diffusion.
epriestley added subscribers: epriestley, zeeg, davidressman and 2 others.
epriestley edited this Maniphest Task.Dec 3 2013, 5:05 PM
hwinkel added a subscriber: hwinkel.
epriestley edited this Maniphest Task.Dec 5 2013, 1:29 AM
epriestley edited this Maniphest Task.Dec 5 2013, 4:40 AM
epriestley edited this Maniphest Task.Dec 5 2013, 5:18 AM
epriestley edited this Maniphest Task.Dec 5 2013, 7:37 PM
epriestley edited this Maniphest Task.Dec 5 2013, 7:56 PM
epriestley edited this Maniphest Task.Dec 5 2013, 7:59 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 12 2013, 8:24 PM
epriestley edited this Maniphest Task.Dec 13 2013, 12:03 AM
epriestley edited this Maniphest Task.Dec 13 2013, 12:06 AM
epriestley edited this Maniphest Task.Dec 13 2013, 12:59 AM
epriestley edited this Maniphest Task.Dec 13 2013, 1:39 AM
epriestley edited this Maniphest Task.Dec 13 2013, 1:56 AM
epriestley edited this Maniphest Task.Dec 14 2013, 1:24 AM
epriestley edited this Maniphest Task.Dec 17 2013, 4:32 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 17 2013, 5:19 PM
epriestley edited this Maniphest Task.Dec 17 2013, 7:12 PM
epriestley edited this Maniphest Task.Dec 17 2013, 8:36 PM
epriestley edited this Maniphest Task.Dec 17 2013, 8:55 PM
epriestley edited this Maniphest Task.Dec 17 2013, 10:05 PM
epriestley edited this Maniphest Task.Dec 17 2013, 11:23 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 18 2013, 8:12 PM
epriestley edited this Maniphest Task.Dec 18 2013, 9:06 PM
epriestley edited this Maniphest Task.Dec 18 2013, 9:21 PM
epriestley edited this Maniphest Task.Dec 18 2013, 9:26 PM
epriestley edited this Maniphest Task.Dec 18 2013, 10:19 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 18 2013, 10:21 PM
epriestley edited this Maniphest Task.Dec 18 2013, 10:46 PM
epriestley edited this Maniphest Task.Dec 18 2013, 11:00 PM
epriestley edited this Maniphest Task.Dec 18 2013, 11:09 PM
epriestley edited this Maniphest Task.Dec 19 2013, 1:48 AM
epriestley edited this Maniphest Task.
wotte added a subscriber: wotte.Dec 19 2013, 4:32 AM
epriestley edited this Maniphest Task.Dec 19 2013, 2:56 PM
epriestley edited this Maniphest Task.Dec 19 2013, 3:50 PM
epriestley edited this Maniphest Task.Dec 19 2013, 4:42 PM
epriestley edited this Maniphest Task.Dec 19 2013, 5:06 PM
epriestley edited this Maniphest Task.Dec 19 2013, 7:05 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 19 2013, 9:16 PM
epriestley edited this Maniphest Task.Dec 19 2013, 9:42 PM
epriestley edited this Maniphest Task.Dec 19 2013, 10:08 PM
epriestley edited this Maniphest Task.Dec 19 2013, 10:18 PM
epriestley edited this Maniphest Task.Dec 20 2013, 12:04 AM
epriestley edited this Maniphest Task.Dec 20 2013, 12:23 AM
epriestley edited this Maniphest Task.Dec 20 2013, 8:38 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Dec 23 2013, 7:16 PM
epriestley edited this Maniphest Task.Dec 26 2013, 6:40 PM
epriestley closed this task as Resolved.Dec 26 2013, 6:40 PM

Closed by commit rPadcc4ee1db1d.

epriestley edited this Maniphest Task.Dec 27 2013, 12:04 AM
epriestley edited this Maniphest Task.Dec 27 2013, 9:16 PM