From fd5beffb995072dc77eee80f55aec48ab7d8931d Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 5 Dec 2012 15:34:28 -0800 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 - .../PhabricatorRepositoryEditController.php | 28 ------- ...sitoryDefaultCommitMessageDetailParser.php | 81 ------------------- ...torRepositoryCommitMessageParserWorker.php | 8 -- 4 files changed, 119 deletions(-) delete mode 100644 src/applications/repository/parser/PhabricatorRepositoryDefaultCommitMessageDetailParser.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 46af533643..1c90dadd14 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index 9af13bf8fd..077bd9ab25 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -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( - '

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.

') - ->appendChild( - id(new AphrontFormSelectControl()) - ->setName('detail-parser') - ->setLabel('Detail Parser') - ->setOptions($parsers) - ->setValue( - $repository->getDetail( - 'detail-parser', - 'PhabricatorRepositoryDefaultCommitMessageDetailParser'))); - if ($is_svn) { $inset ->appendChild( diff --git a/src/applications/repository/parser/PhabricatorRepositoryDefaultCommitMessageDetailParser.php b/src/applications/repository/parser/PhabricatorRepositoryDefaultCommitMessageDetailParser.php deleted file mode 100644 index 301e39f7e3..0000000000 --- a/src/applications/repository/parser/PhabricatorRepositoryDefaultCommitMessageDetailParser.php +++ /dev/null @@ -1,81 +0,0 @@ -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); - } - -} diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 70cedc63bf..dd391c1060 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -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,