2011-03-31 08:27:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Facebook, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
abstract class DiffusionLastModifiedQuery {
|
|
|
|
|
|
|
|
private $request;
|
|
|
|
|
|
|
|
final private function __construct() {
|
|
|
|
// <private>
|
|
|
|
}
|
|
|
|
|
|
|
|
final public static function newFromDiffusionRequest(
|
|
|
|
DiffusionRequest $request) {
|
|
|
|
|
|
|
|
$repository = $request->getRepository();
|
|
|
|
|
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
|
|
|
$class = 'DiffusionGitLastModifiedQuery';
|
|
|
|
break;
|
Basic support for Mercurial in Diffusion
Summary: Change import script plus almost all the view stuff. Still some rough
edges but this seems to mostly work. Blame is currently unsupported but I think
everything else works properly.
Test Plan:
Imported the hg repository itself. It doesn't immediately seem completely
broken. Here are some screens:
https://secure.phabricator.com/file/view/PHID-FILE-1438b71cc7c4a2eb4569/
https://secure.phabricator.com/file/view/PHID-FILE-3cec4f72f39e7de2d041/
https://secure.phabricator.com/file/view/PHID-FILE-2ea4883f160e8e5098f9/
https://secure.phabricator.com/file/view/PHID-FILE-35f751a36ebf65399ade/
All the parsers were able to churn through it without errors.
Ran the new "reparse.php" script in various one-commit and repository modes.
Browsed/imported some git repos for good measure.
NOTE: The hg repository is only 15,000 commits and around 1,000 files.
Performance is okay but hg doesn't provide performant, native APIs to get some
data efficiently so we have to do some dumb stuff. If some of these interfaces
are cripplingly slow or whatever, let me know and we can start bundling some
Mercurial extensions with Arcanist.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: Makinde
CC: aran, Makinde, epriestley
Differential Revision: 960
2011-09-26 20:07:38 +02:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
|
|
|
$class = 'DiffusionMercurialLastModifiedQuery';
|
|
|
|
break;
|
2011-03-31 08:27:06 +02:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$class = 'DiffusionSvnLastModifiedQuery';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw new Exception("Unsupported VCS!");
|
|
|
|
}
|
|
|
|
|
|
|
|
PhutilSymbolLoader::loadClass($class);
|
|
|
|
$query = new $class();
|
|
|
|
|
|
|
|
$query->request = $request;
|
|
|
|
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
final protected function getRequest() {
|
|
|
|
return $this->request;
|
|
|
|
}
|
|
|
|
|
|
|
|
final public function loadLastModification() {
|
|
|
|
return $this->executeQuery();
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract protected function executeQuery();
|
|
|
|
|
|
|
|
}
|