1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Remove PhabricatorRepositoryDefaultCommitMessageDetailParser

Summary: See discussion in T1544. This has been obsoleted by simpler/better mechanisms.

Test Plan: Edited a repository; ran a parse task.

Reviewers: edward

Reviewed By: edward

CC: aran

Maniphest Tasks: T1544

Differential Revision: https://secure.phabricator.com/D3977
This commit is contained in:
epriestley 2012-12-05 15:34:28 -08:00
parent c3dbbc5fbe
commit fd5beffb99
4 changed files with 0 additions and 119 deletions

View file

@ -1016,7 +1016,6 @@ phutil_register_library_map(array(
'PhabricatorRepositoryController' => 'applications/repository/controller/PhabricatorRepositoryController.php',
'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
'PhabricatorRepositoryDefaultCommitMessageDetailParser' => 'applications/repository/parser/PhabricatorRepositoryDefaultCommitMessageDetailParser.php',
'PhabricatorRepositoryDeleteController' => 'applications/repository/controller/PhabricatorRepositoryDeleteController.php',
'PhabricatorRepositoryEditController' => 'applications/repository/controller/PhabricatorRepositoryEditController.php',
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php',
@ -2232,7 +2231,6 @@ phutil_register_library_map(array(
'PhabricatorRepositoryController' => 'PhabricatorController',
'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorRepositoryDefaultCommitMessageDetailParser' => 'PhabricatorRepositoryCommitMessageDetailParser',
'PhabricatorRepositoryDeleteController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryEditController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',

View file

@ -295,12 +295,6 @@ final class PhabricatorRepositoryEditController
$repository->setDetail('svn-subpath', $subpath);
}
$repository->setDetail(
'detail-parser',
$request->getStr(
'detail-parser',
'PhabricatorRepositoryDefaultCommitMessageDetailParser'));
if ($tracking) {
if (!$repository->getDetail('remote-uri')) {
$e_uri = 'Required';
@ -650,28 +644,6 @@ final class PhabricatorRepositoryEditController
'a repository. Feed stories are never published about commits '.
'that are more than 24 hours old.'));
$parsers = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorRepositoryCommitMessageDetailParser')
->selectSymbolsWithoutLoading();
$parsers = ipull($parsers, 'name', 'name');
$inset
->appendChild(
'<p class="aphront-form-instructions">If you extend the commit '.
'message format, you can provide a new parser which will extract '.
'extra information from it when commits are imported. This is an '.
'advanced feature, and using the default parser will be suitable '.
'in most cases.</p>')
->appendChild(
id(new AphrontFormSelectControl())
->setName('detail-parser')
->setLabel('Detail Parser')
->setOptions($parsers)
->setValue(
$repository->getDetail(
'detail-parser',
'PhabricatorRepositoryDefaultCommitMessageDetailParser')));
if ($is_svn) {
$inset
->appendChild(

View file

@ -1,81 +0,0 @@
<?php
/**
* TODO: Facebook extends this (I think?), but should it?
*/
class PhabricatorRepositoryDefaultCommitMessageDetailParser
extends PhabricatorRepositoryCommitMessageDetailParser {
public function parseCommitDetails() {
$commit = $this->getCommit();
$data = $this->getCommitData();
$details = nonempty($data->getCommitDetails(), array());
$message = $data->getCommitMessage();
$author_name = $data->getAuthorName();
// TODO: Some day, it would be good to drive all of this via
// DifferentialFieldSpecification configuration directly.
$match = null;
if (preg_match(
'/^\s*Differential Revision:\s*(\S+)\s*$/mi',
$message,
$match)) {
// NOTE: We now accept ONLY full URIs because if we accept numeric IDs
// then anyone importing the Phabricator repository will have their
// first few thousand revisions marked closed. This does mean that
// some older revisions won't re-parse correctly, but that shouldn't
// really affect anyone. If necessary, an install can extend the parser
// and restore the older, more-liberal parsing fairly easily.
$id = DifferentialRevisionIDFieldSpecification::parseRevisionIDFromURI(
$match[1]);
if ($id) {
$details['differential.revisionID'] = $id;
$revision = id(new DifferentialRevision())->load($id);
if ($revision) {
$details['differential.revisionPHID'] = $revision->getPHID();
}
}
}
if (preg_match(
'/^\s*Reviewed By:\s*(\S+)\s*$/mi',
$message,
$match)) {
$details['reviewerName'] = $match[1];
$reviewer_phid = $this->resolveUserPHID($details['reviewerName']);
if ($reviewer_phid) {
$details['reviewerPHID'] = $reviewer_phid;
} else {
unset($details['reviewerPHID']);
}
} else {
unset($details['reviewerName']);
unset($details['reviewerPHID']);
}
$author_phid = $this->resolveUserPHID($author_name);
if ($author_phid) {
$details['authorPHID'] = $author_phid;
} else {
unset($details['authorPHID']);
}
if (isset($details['committer'])) {
$committer_phid = $this->resolveUserPHID($details['committer']);
if ($committer_phid) {
$details['committerPHID'] = $committer_phid;
} else {
unset($details['committerPHID']);
}
}
$data->setCommitDetails($details);
}
}

View file

@ -27,14 +27,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
}
$repository = $this->repository;
$detail_parser = $repository->getDetail(
'detail-parser',
'PhabricatorRepositoryDefaultCommitMessageDetailParser');
if ($detail_parser) {
$parser_obj = newv($detail_parser, array($commit, $data));
$parser_obj->parseCommitDetails();
}
$author_phid = $this->lookupUser(
$commit,