1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add audit entry when code changed after a revision was accepted

Summary: build on top of D2530 and D2540. Add an auditing entry when the code was changed after the revision was accepted.

Test Plan: ran reparse.php manually. It worked at https://phabricator.fb.com/rPHGIT461864d2e09dad04c28505658ef75a979e44d0d3. Look at the latest auditing entry for auditor 'phgit ha directory'.

Reviewers: vrana

Reviewed By: vrana

CC: nh, epriestley, aran

Maniphest Tasks: T201

Differential Revision: https://secure.phabricator.com/D2586
This commit is contained in:
Jason Ge 2012-05-27 18:11:47 -07:00
parent 0044b9cca9
commit bbd5c8c187
3 changed files with 14 additions and 5 deletions

View file

@ -48,4 +48,9 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
return idx($this->commitDetails, $key, $default);
}
public function setCommitDetail($key, $value) {
$this->commitDetails[$key] = $value;
return $this;
}
}

View file

@ -39,9 +39,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$data->setCommitMessage($message);
if ($committer) {
$details = $data->getCommitDetails();
$details['committer'] = $committer;
$data->setCommitDetails($details);
$data->setCommitDetail('committer', $committer);
}
$repository = $this->repository;
@ -61,8 +59,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$commit->save();
}
$data->save();
$conn_w = id(new DifferentialRevision())->establishConnection('w');
// NOTE: The `differential_commit` table has a unique ID on `commitPHID`,
@ -128,6 +124,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
if ($commit_is_new) {
$vs_diff = $this->loadChangedByCommit($diff);
if ($vs_diff) {
$data->setCommitDetail('vsDiff', $vs_diff->getID());
$changed_by_commit = PhabricatorEnv::getProductionURI(
'/D'.$revision->getID().
'?vs='.$vs_diff->getID().
@ -142,6 +140,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
}
}
$data->save();
}
private function attachToRevision(

View file

@ -93,6 +93,10 @@ final class PhabricatorRepositoryCommitOwnersWorker
$reasons = array();
if ($data->getCommitDetail('vsDiff')) {
$reasons[] = "Changed After Revision Was Accepted";
}
$commit_author_phid = $data->getCommitDetail('authorPHID');
if (!$commit_author_phid) {
$reasons[] = "Commit Author Not Recognized";