Add an event for looking up names from repositories
Summary: Currently, we have this cumbersome `PhabricatorRepositoryCommitMessageDetailParser` hook. This is really old and outdated; I want to just use the Differential custom field parser. See T945 for a specific application. However, it allows installs to override author/committer association. Instead, provide an event hook for doing this. Test Plan: Added a listener, made every commit resolve to "turtle", parsed some commits, verified the events looked sane and they now correctly were all attributed to "turtle". Reviewers: btrahan, vrana, nh Reviewed By: btrahan CC: aran Maniphest Tasks: T1337 Differential Revision: https://secure.phabricator.com/D3040
This commit is contained in:
@@ -138,6 +138,35 @@ will be available yet. Data available on this event:
|
||||
- `repository` The @{class:PhabricatorRepository} the commit was discovered
|
||||
in.
|
||||
|
||||
== Diffusion: Lookup User ==
|
||||
|
||||
The constant for this event is
|
||||
`PhabricatorEventType::TYPE_DIFFUSION_LOOKUPUSER`.
|
||||
|
||||
This event is dispatched when the daemons are trying to link a commit to a
|
||||
Phabricator user account. You can listen for it to improve the accuracy of
|
||||
associating users with their commits.
|
||||
|
||||
By default, Phabricator will try to find matches based on usernames, real names,
|
||||
or email addresses, but this can result in incorrect matches (e.g., if you have
|
||||
several employees with the same name) or failures to match (e.g., if someone
|
||||
changed their email address). Listening for this event allows you to intercept
|
||||
the lookup and supplement the results from another datasource.
|
||||
|
||||
Data available on this event:
|
||||
|
||||
- `commit` The @{class:PhabricatorRepositoryCommit} that data is being looked
|
||||
up for.
|
||||
- `query` The author or committer string being looked up. This will usually
|
||||
be something like "Abraham Lincoln <alincoln@logcabin.example.com>", but
|
||||
comes from the commit metadata so it may not be well-formatted.
|
||||
- `result` The current result from the lookup (Phabricator's best guess at
|
||||
the user PHID of the user named in the "query"). To substitute the result
|
||||
with a different result, replace this with the correct PHID in your event
|
||||
listener.
|
||||
|
||||
Using @{class:PhutilEmailAddress} may be helpful in parsing the query.
|
||||
|
||||
== Edge: Will Edit Edges ==
|
||||
|
||||
NOTE: Edge events are low-level events deep in the core. It is more difficult to
|
||||
|
||||
Reference in New Issue
Block a user