mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Show parent commits in Diffusion
Summary: Show parent commit information to make it easier to understand merges. Test Plan: Looked at commits in SVN, hg, git. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T961 Differential Revision: https://secure.phabricator.com/D2021
This commit is contained in:
parent
59b49e6429
commit
3bacba7e9f
12 changed files with 272 additions and 22 deletions
|
@ -290,6 +290,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommentView' => 'applications/diffusion/view/comment',
|
'DiffusionCommentView' => 'applications/diffusion/view/comment',
|
||||||
'DiffusionCommitChangeTableView' => 'applications/diffusion/view/commitchangetable',
|
'DiffusionCommitChangeTableView' => 'applications/diffusion/view/commitchangetable',
|
||||||
'DiffusionCommitController' => 'applications/diffusion/controller/commit',
|
'DiffusionCommitController' => 'applications/diffusion/controller/commit',
|
||||||
|
'DiffusionCommitParentsQuery' => 'applications/diffusion/query/parents/base',
|
||||||
'DiffusionContainsQuery' => 'applications/diffusion/query/contains/base',
|
'DiffusionContainsQuery' => 'applications/diffusion/query/contains/base',
|
||||||
'DiffusionController' => 'applications/diffusion/controller/base',
|
'DiffusionController' => 'applications/diffusion/controller/base',
|
||||||
'DiffusionDiffController' => 'applications/diffusion/controller/diff',
|
'DiffusionDiffController' => 'applications/diffusion/controller/diff',
|
||||||
|
@ -301,6 +302,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionGitBranchQuery' => 'applications/diffusion/query/branch/git',
|
'DiffusionGitBranchQuery' => 'applications/diffusion/query/branch/git',
|
||||||
'DiffusionGitBranchQueryTestCase' => 'applications/diffusion/query/branch/git/__tests__',
|
'DiffusionGitBranchQueryTestCase' => 'applications/diffusion/query/branch/git/__tests__',
|
||||||
'DiffusionGitBrowseQuery' => 'applications/diffusion/query/browse/git',
|
'DiffusionGitBrowseQuery' => 'applications/diffusion/query/browse/git',
|
||||||
|
'DiffusionGitCommitParentsQuery' => 'applications/diffusion/query/parents/git',
|
||||||
'DiffusionGitContainsQuery' => 'applications/diffusion/query/contains/git',
|
'DiffusionGitContainsQuery' => 'applications/diffusion/query/contains/git',
|
||||||
'DiffusionGitDiffQuery' => 'applications/diffusion/query/diff/git',
|
'DiffusionGitDiffQuery' => 'applications/diffusion/query/diff/git',
|
||||||
'DiffusionGitFileContentQuery' => 'applications/diffusion/query/filecontent/git',
|
'DiffusionGitFileContentQuery' => 'applications/diffusion/query/filecontent/git',
|
||||||
|
@ -317,6 +319,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionLastModifiedQuery' => 'applications/diffusion/query/lastmodified/base',
|
'DiffusionLastModifiedQuery' => 'applications/diffusion/query/lastmodified/base',
|
||||||
'DiffusionMercurialBranchQuery' => 'applications/diffusion/query/branch/mercurial',
|
'DiffusionMercurialBranchQuery' => 'applications/diffusion/query/branch/mercurial',
|
||||||
'DiffusionMercurialBrowseQuery' => 'applications/diffusion/query/browse/mercurial',
|
'DiffusionMercurialBrowseQuery' => 'applications/diffusion/query/browse/mercurial',
|
||||||
|
'DiffusionMercurialCommitParentsQuery' => 'applications/diffusion/query/parents/mercurial',
|
||||||
'DiffusionMercurialContainsQuery' => 'applications/diffusion/query/contains/mercurial',
|
'DiffusionMercurialContainsQuery' => 'applications/diffusion/query/contains/mercurial',
|
||||||
'DiffusionMercurialDiffQuery' => 'applications/diffusion/query/diff/mercurial',
|
'DiffusionMercurialDiffQuery' => 'applications/diffusion/query/diff/mercurial',
|
||||||
'DiffusionMercurialFileContentQuery' => 'applications/diffusion/query/filecontent/mercurial',
|
'DiffusionMercurialFileContentQuery' => 'applications/diffusion/query/filecontent/mercurial',
|
||||||
|
@ -337,6 +340,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryPath' => 'applications/diffusion/data/repositorypath',
|
'DiffusionRepositoryPath' => 'applications/diffusion/data/repositorypath',
|
||||||
'DiffusionRequest' => 'applications/diffusion/request/base',
|
'DiffusionRequest' => 'applications/diffusion/request/base',
|
||||||
'DiffusionSvnBrowseQuery' => 'applications/diffusion/query/browse/svn',
|
'DiffusionSvnBrowseQuery' => 'applications/diffusion/query/browse/svn',
|
||||||
|
'DiffusionSvnCommitParentsQuery' => 'applications/diffusion/query/parents/svn',
|
||||||
'DiffusionSvnContainsQuery' => 'applications/diffusion/query/contains/svn',
|
'DiffusionSvnContainsQuery' => 'applications/diffusion/query/contains/svn',
|
||||||
'DiffusionSvnDiffQuery' => 'applications/diffusion/query/diff/svn',
|
'DiffusionSvnDiffQuery' => 'applications/diffusion/query/diff/svn',
|
||||||
'DiffusionSvnFileContentQuery' => 'applications/diffusion/query/filecontent/svn',
|
'DiffusionSvnFileContentQuery' => 'applications/diffusion/query/filecontent/svn',
|
||||||
|
@ -1157,6 +1161,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommentView' => 'AphrontView',
|
'DiffusionCommentView' => 'AphrontView',
|
||||||
'DiffusionCommitChangeTableView' => 'DiffusionView',
|
'DiffusionCommitChangeTableView' => 'DiffusionView',
|
||||||
'DiffusionCommitController' => 'DiffusionController',
|
'DiffusionCommitController' => 'DiffusionController',
|
||||||
|
'DiffusionCommitParentsQuery' => 'DiffusionQuery',
|
||||||
'DiffusionContainsQuery' => 'DiffusionQuery',
|
'DiffusionContainsQuery' => 'DiffusionQuery',
|
||||||
'DiffusionController' => 'PhabricatorController',
|
'DiffusionController' => 'PhabricatorController',
|
||||||
'DiffusionDiffController' => 'DiffusionController',
|
'DiffusionDiffController' => 'DiffusionController',
|
||||||
|
@ -1165,6 +1170,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionGitBranchQuery' => 'DiffusionBranchQuery',
|
'DiffusionGitBranchQuery' => 'DiffusionBranchQuery',
|
||||||
'DiffusionGitBranchQueryTestCase' => 'PhabricatorTestCase',
|
'DiffusionGitBranchQueryTestCase' => 'PhabricatorTestCase',
|
||||||
'DiffusionGitBrowseQuery' => 'DiffusionBrowseQuery',
|
'DiffusionGitBrowseQuery' => 'DiffusionBrowseQuery',
|
||||||
|
'DiffusionGitCommitParentsQuery' => 'DiffusionCommitParentsQuery',
|
||||||
'DiffusionGitContainsQuery' => 'DiffusionContainsQuery',
|
'DiffusionGitContainsQuery' => 'DiffusionContainsQuery',
|
||||||
'DiffusionGitDiffQuery' => 'DiffusionDiffQuery',
|
'DiffusionGitDiffQuery' => 'DiffusionDiffQuery',
|
||||||
'DiffusionGitFileContentQuery' => 'DiffusionFileContentQuery',
|
'DiffusionGitFileContentQuery' => 'DiffusionFileContentQuery',
|
||||||
|
@ -1180,6 +1186,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionLastModifiedController' => 'DiffusionController',
|
'DiffusionLastModifiedController' => 'DiffusionController',
|
||||||
'DiffusionMercurialBranchQuery' => 'DiffusionBranchQuery',
|
'DiffusionMercurialBranchQuery' => 'DiffusionBranchQuery',
|
||||||
'DiffusionMercurialBrowseQuery' => 'DiffusionBrowseQuery',
|
'DiffusionMercurialBrowseQuery' => 'DiffusionBrowseQuery',
|
||||||
|
'DiffusionMercurialCommitParentsQuery' => 'DiffusionCommitParentsQuery',
|
||||||
'DiffusionMercurialContainsQuery' => 'DiffusionContainsQuery',
|
'DiffusionMercurialContainsQuery' => 'DiffusionContainsQuery',
|
||||||
'DiffusionMercurialDiffQuery' => 'DiffusionDiffQuery',
|
'DiffusionMercurialDiffQuery' => 'DiffusionDiffQuery',
|
||||||
'DiffusionMercurialFileContentQuery' => 'DiffusionFileContentQuery',
|
'DiffusionMercurialFileContentQuery' => 'DiffusionFileContentQuery',
|
||||||
|
@ -1193,6 +1200,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionPathValidateController' => 'DiffusionController',
|
'DiffusionPathValidateController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryController' => 'DiffusionController',
|
'DiffusionRepositoryController' => 'DiffusionController',
|
||||||
'DiffusionSvnBrowseQuery' => 'DiffusionBrowseQuery',
|
'DiffusionSvnBrowseQuery' => 'DiffusionBrowseQuery',
|
||||||
|
'DiffusionSvnCommitParentsQuery' => 'DiffusionCommitParentsQuery',
|
||||||
'DiffusionSvnContainsQuery' => 'DiffusionContainsQuery',
|
'DiffusionSvnContainsQuery' => 'DiffusionContainsQuery',
|
||||||
'DiffusionSvnDiffQuery' => 'DiffusionDiffQuery',
|
'DiffusionSvnDiffQuery' => 'DiffusionDiffQuery',
|
||||||
'DiffusionSvnFileContentQuery' => 'DiffusionFileContentQuery',
|
'DiffusionSvnFileContentQuery' => 'DiffusionFileContentQuery',
|
||||||
|
|
|
@ -74,22 +74,29 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
require_celerity_resource('diffusion-commit-view-css');
|
require_celerity_resource('diffusion-commit-view-css');
|
||||||
require_celerity_resource('phabricator-remarkup-css');
|
require_celerity_resource('phabricator-remarkup-css');
|
||||||
|
|
||||||
$property_table = $this->renderPropertyTable($commit, $commit_data);
|
$parent_query = DiffusionCommitParentsQuery::newFromDiffusionRequest(
|
||||||
|
$drequest);
|
||||||
|
$parents = $parent_query->loadParents();
|
||||||
|
|
||||||
|
$property_table = $this->renderPropertyTable(
|
||||||
|
$commit,
|
||||||
|
$commit_data,
|
||||||
|
$parents);
|
||||||
|
|
||||||
|
$detail_panel->setHeader('Revision Detail');
|
||||||
|
$detail_panel->addButton(
|
||||||
|
'<div class="diffusion-commit-dateline">'.
|
||||||
|
'r'.$callsign.$commit->getCommitIdentifier().
|
||||||
|
' · '.
|
||||||
|
phabricator_datetime($commit->getEpoch(), $user).
|
||||||
|
'</div>');
|
||||||
|
|
||||||
$detail_panel->appendChild(
|
$detail_panel->appendChild(
|
||||||
'<div class="diffusion-commit-view">'.
|
'<div class="diffusion-commit-details">'.
|
||||||
'<div class="diffusion-commit-dateline">'.
|
$property_table.
|
||||||
'r'.$callsign.$commit->getCommitIdentifier().
|
'<hr />'.
|
||||||
' · '.
|
'<div class="diffusion-commit-message phabricator-remarkup">'.
|
||||||
phabricator_datetime($commit->getEpoch(), $user).
|
$engine->markupText($commit_data->getCommitMessage()).
|
||||||
'</div>'.
|
|
||||||
'<h1>Revision Detail</h1>'.
|
|
||||||
'<div class="diffusion-commit-details">'.
|
|
||||||
$property_table.
|
|
||||||
'<hr />'.
|
|
||||||
'<div class="diffusion-commit-message phabricator-remarkup">'.
|
|
||||||
$engine->markupText($commit_data->getCommitMessage()).
|
|
||||||
'</div>'.
|
|
||||||
'</div>'.
|
'</div>'.
|
||||||
'</div>');
|
'</div>');
|
||||||
|
|
||||||
|
@ -268,7 +275,8 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
|
|
||||||
private function renderPropertyTable(
|
private function renderPropertyTable(
|
||||||
PhabricatorRepositoryCommit $commit,
|
PhabricatorRepositoryCommit $commit,
|
||||||
PhabricatorRepositoryCommitData $data) {
|
PhabricatorRepositoryCommitData $data,
|
||||||
|
array $parents) {
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
if ($data->getCommitDetail('authorPHID')) {
|
if ($data->getCommitDetail('authorPHID')) {
|
||||||
|
@ -280,6 +288,11 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
if ($data->getCommitDetail('differential.revisionPHID')) {
|
if ($data->getCommitDetail('differential.revisionPHID')) {
|
||||||
$phids[] = $data->getCommitDetail('differential.revisionPHID');
|
$phids[] = $data->getCommitDetail('differential.revisionPHID');
|
||||||
}
|
}
|
||||||
|
if ($parents) {
|
||||||
|
foreach ($parents as $parent) {
|
||||||
|
$phids[] = $parent->getPHID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$handles = array();
|
$handles = array();
|
||||||
if ($phids) {
|
if ($phids) {
|
||||||
|
@ -314,6 +327,14 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$commit->getAuditStatus());
|
$commit->getAuditStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($parents) {
|
||||||
|
$parent_links = array();
|
||||||
|
foreach ($parents as $parent) {
|
||||||
|
$parent_links[] = $handles[$parent->getPHID()]->renderLink();
|
||||||
|
}
|
||||||
|
$props['Parents'] = implode(' · ', $parent_links);
|
||||||
|
}
|
||||||
|
|
||||||
$request = $this->getDiffusionRequest();
|
$request = $this->getDiffusionRequest();
|
||||||
|
|
||||||
$contains = DiffusionContainsQuery::newFromDiffusionRequest($request);
|
$contains = DiffusionContainsQuery::newFromDiffusionRequest($request);
|
||||||
|
|
|
@ -20,6 +20,7 @@ phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
|
phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/contains/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/contains/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/mergedcommits/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/mergedcommits/base');
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/query/parents/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/path');
|
phutil_require_module('phabricator', 'applications/diffusion/query/path');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/pathid/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/pathid/base');
|
||||||
|
|
|
@ -58,26 +58,27 @@ abstract class DiffusionQuery {
|
||||||
/* -( Query Utilities )---------------------------------------------------- */
|
/* -( Query Utilities )---------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
final protected function loadHistoryForCommitIdentifiers(array $identifiers) {
|
final protected function loadCommitsByIdentifiers(array $identifiers) {
|
||||||
if (!$identifiers) {
|
if (!$identifiers) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$commits = array();
|
$commits = array();
|
||||||
$commit_data = array();
|
$commit_data = array();
|
||||||
$path_changes = array();
|
|
||||||
|
|
||||||
$drequest = $this->getRequest();
|
$drequest = $this->getRequest();
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
$path = $drequest->getPath();
|
|
||||||
|
|
||||||
$commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
|
$commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
|
||||||
'repositoryID = %d AND commitIdentifier IN (%Ls)',
|
'repositoryID = %d AND commitIdentifier IN (%Ls)',
|
||||||
$repository->getID(),
|
$repository->getID(),
|
||||||
$identifiers);
|
$identifiers);
|
||||||
$commits = mpull($commits, null, 'getCommitIdentifier');
|
$commits = mpull($commits, null, 'getCommitIdentifier');
|
||||||
|
|
||||||
|
// Reorder the commits in identifier order so we preserve nth-parent
|
||||||
|
// relationships when the identifiers are the parents of a merge commit.
|
||||||
|
$commits = array_select_keys($commits, $identifiers);
|
||||||
|
|
||||||
if (!$commits) {
|
if (!$commits) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -87,6 +88,27 @@ abstract class DiffusionQuery {
|
||||||
mpull($commits, 'getID'));
|
mpull($commits, 'getID'));
|
||||||
$commit_data = mpull($commit_data, null, 'getCommitID');
|
$commit_data = mpull($commit_data, null, 'getCommitID');
|
||||||
|
|
||||||
|
foreach ($commits as $commit) {
|
||||||
|
if (idx($commit_data, $commit->getID())) {
|
||||||
|
$commit->attachCommitData($commit_data[$commit->getID()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $commits;
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected function loadHistoryForCommitIdentifiers(array $identifiers) {
|
||||||
|
if (!$identifiers) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$drequest = $this->getRequest();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
$commits = self::loadCommitsByIdentifiers($identifiers);
|
||||||
|
|
||||||
|
|
||||||
|
$path = $drequest->getPath();
|
||||||
|
|
||||||
$conn_r = $repository->establishConnection('r');
|
$conn_r = $repository->establishConnection('r');
|
||||||
|
|
||||||
$path_normal = DiffusionPathIDQuery::normalizePath($path);
|
$path_normal = DiffusionPathIDQuery::normalizePath($path);
|
||||||
|
@ -113,9 +135,10 @@ abstract class DiffusionQuery {
|
||||||
$commit = idx($commits, $identifier);
|
$commit = idx($commits, $identifier);
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$item->setCommit($commit);
|
$item->setCommit($commit);
|
||||||
$data = idx($commit_data, $commit->getID());
|
try {
|
||||||
if ($data) {
|
$item->setCommitData($commit->getCommitData());
|
||||||
$item->setCommitData($data);
|
} catch (Exception $ex) {
|
||||||
|
// Ignore, commit just doesn't have data.
|
||||||
}
|
}
|
||||||
$change = idx($path_changes, $commit->getID());
|
$change = idx($path_changes, $commit->getID());
|
||||||
if ($change) {
|
if ($change) {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 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 DiffusionCommitParentsQuery extends DiffusionQuery {
|
||||||
|
|
||||||
|
final public static function newFromDiffusionRequest(
|
||||||
|
DiffusionRequest $request) {
|
||||||
|
return self::newQueryObject(__CLASS__, $request);
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function loadParents() {
|
||||||
|
return $this->executeQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
src/applications/diffusion/query/parents/base/__init__.php
Normal file
12
src/applications/diffusion/query/parents/base/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/query/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('DiffusionCommitParentsQuery.php');
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class DiffusionGitCommitParentsQuery
|
||||||
|
extends DiffusionCommitParentsQuery {
|
||||||
|
|
||||||
|
protected function executeQuery() {
|
||||||
|
$drequest = $this->getRequest();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
list($stdout) = $repository->execxLocalCommand(
|
||||||
|
'log -n 1 --format=%s %s',
|
||||||
|
'%P',
|
||||||
|
$drequest->getStableCommitName());
|
||||||
|
|
||||||
|
$hashes = preg_split('/\s+/', trim($stdout));
|
||||||
|
|
||||||
|
return self::loadCommitsByIdentifiers($hashes);
|
||||||
|
}
|
||||||
|
}
|
12
src/applications/diffusion/query/parents/git/__init__.php
Normal file
12
src/applications/diffusion/query/parents/git/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/query/parents/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('DiffusionGitCommitParentsQuery.php');
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class DiffusionMercurialCommitParentsQuery
|
||||||
|
extends DiffusionCommitParentsQuery {
|
||||||
|
|
||||||
|
protected function executeQuery() {
|
||||||
|
$drequest = $this->getRequest();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
list($stdout) = $repository->execxLocalCommand(
|
||||||
|
'log --debug --limit 1 --template={parents} --rev %s',
|
||||||
|
$drequest->getStableCommitName());
|
||||||
|
|
||||||
|
$hashes = preg_split('/\s+/', trim($stdout));
|
||||||
|
foreach ($hashes as $key => $value) {
|
||||||
|
// Mercurial parents look like "23:ad9f769d6f786fad9f76d9a" -- we want
|
||||||
|
// to strip out the local rev part.
|
||||||
|
list($local, $global) = explode(':', $value);
|
||||||
|
$hashes[$key] = $global;
|
||||||
|
|
||||||
|
// With --debug we get 40-character hashes but also get the "000000..."
|
||||||
|
// hash for missing parents; ignore it.
|
||||||
|
if (preg_match('/^0+$/', $global)) {
|
||||||
|
unset($hashes[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::loadCommitsByIdentifiers($hashes);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/query/parents/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('DiffusionMercurialCommitParentsQuery.php');
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class DiffusionSvnCommitParentsQuery
|
||||||
|
extends DiffusionCommitParentsQuery {
|
||||||
|
|
||||||
|
protected function executeQuery() {
|
||||||
|
$drequest = $this->getRequest();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
// TODO: With merge properties in recent versions of SVN, can we do
|
||||||
|
// a better job of this?
|
||||||
|
|
||||||
|
$n = $drequest->getStableCommitName();
|
||||||
|
if ($n > 1) {
|
||||||
|
$ids = array($n - 1);
|
||||||
|
} else {
|
||||||
|
$ids = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::loadCommitsByIdentifiers($ids);
|
||||||
|
}
|
||||||
|
}
|
12
src/applications/diffusion/query/parents/svn/__init__.php
Normal file
12
src/applications/diffusion/query/parents/svn/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/query/parents/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('DiffusionSvnCommitParentsQuery.php');
|
Loading…
Reference in a new issue