Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/diffusion/query/lastmodified/git/DiffusionGitLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/git/DiffusionGitLastModifiedQuery.php
index be1113dbc9..ed40cb7364 100644
--- a/src/applications/diffusion/query/lastmodified/git/DiffusionGitLastModifiedQuery.php
+++ b/src/applications/diffusion/query/lastmodified/git/DiffusionGitLastModifiedQuery.php
@@ -1,46 +1,45 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * 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 DiffusionGitLastModifiedQuery extends DiffusionLastModifiedQuery {
protected function executeQuery() {
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
list($hash) = $repository->execxLocalCommand(
'log -n1 --format=%%H %s -- %s',
$drequest->getCommit(),
$drequest->getPath());
$hash = trim($hash);
- $commit_data = null;
-
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$hash);
+
if ($commit) {
- $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
- 'commitID = %d',
- $commit->getID());
+ $commit_data = $commit->loadCommitData();
+ } else {
+ $commit_data = null;
}
return array($commit, $commit_data);
}
}
diff --git a/src/applications/diffusion/query/lastmodified/git/__init__.php b/src/applications/diffusion/query/lastmodified/git/__init__.php
index 0f7241f74a..1a30b1b951 100644
--- a/src/applications/diffusion/query/lastmodified/git/__init__.php
+++ b/src/applications/diffusion/query/lastmodified/git/__init__.php
@@ -1,16 +1,15 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
phutil_require_module('phabricator', 'applications/repository/storage/commit');
-phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
phutil_require_module('phutil', 'utils');
phutil_require_source('DiffusionGitLastModifiedQuery.php');
diff --git a/src/applications/diffusion/query/lastmodified/mercurial/DiffusionMercurialLastModifiedQuery.php b/src/applications/diffusion/query/lastmodified/mercurial/DiffusionMercurialLastModifiedQuery.php
index eb3db5521f..3c55063830 100644
--- a/src/applications/diffusion/query/lastmodified/mercurial/DiffusionMercurialLastModifiedQuery.php
+++ b/src/applications/diffusion/query/lastmodified/mercurial/DiffusionMercurialLastModifiedQuery.php
@@ -1,50 +1,50 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * 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 DiffusionMercurialLastModifiedQuery
extends DiffusionLastModifiedQuery {
protected function executeQuery() {
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
$path = $drequest->getPath();
// TODO: Share some of this with History query.
list($hash) = $repository->execxLocalCommand(
'log --template %s --limit 1 --branch %s --rev %s:0 -- %s',
- '{node}\\n',
+ '{node}',
$drequest->getBranch(),
$drequest->getCommit(),
nonempty(ltrim($path, '/'), '.'));
- $hash = trim($hash);
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$hash);
+
if ($commit) {
- $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
- 'commitID = %d',
- $commit->getID());
+ $commit_data = $commit->loadCommitData();
+ } else {
+ $commit_data = null;
}
return array($commit, $commit_data);
}
}
diff --git a/src/applications/diffusion/query/lastmodified/mercurial/__init__.php b/src/applications/diffusion/query/lastmodified/mercurial/__init__.php
index 5a187f77c3..7efb7c9aee 100644
--- a/src/applications/diffusion/query/lastmodified/mercurial/__init__.php
+++ b/src/applications/diffusion/query/lastmodified/mercurial/__init__.php
@@ -1,16 +1,15 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
phutil_require_module('phabricator', 'applications/repository/storage/commit');
-phutil_require_module('phabricator', 'applications/repository/storage/commitdata');
phutil_require_module('phutil', 'utils');
phutil_require_source('DiffusionMercurialLastModifiedQuery.php');
diff --git a/src/applications/diffusion/view/base/DiffusionView.php b/src/applications/diffusion/view/base/DiffusionView.php
index 05a2101d49..53973f0389 100644
--- a/src/applications/diffusion/view/base/DiffusionView.php
+++ b/src/applications/diffusion/view/base/DiffusionView.php
@@ -1,145 +1,146 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * 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 DiffusionView extends AphrontView {
private $diffusionRequest;
final public function setDiffusionRequest(DiffusionRequest $request) {
$this->diffusionRequest = $request;
return $this;
}
final public function getDiffusionRequest() {
return $this->diffusionRequest;
}
final public function linkChange($change_type, $file_type, $path = null,
$commit_identifier = null) {
$text = DifferentialChangeType::getFullNameForChangeType($change_type);
if ($change_type == DifferentialChangeType::TYPE_CHILD) {
// TODO: Don't link COPY_AWAY without a direct change.
return $text;
}
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
return $text;
}
$drequest = $this->getDiffusionRequest();
if ($commit_identifier) {
$commit = ';'.$commit_identifier;
} else if ($drequest->getRawCommit()) {
$commit = ';'.$drequest->getCommitURIComponent($drequest->getRawCommit());
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.($path ? $path : $drequest->getPath());
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/change/{$path}{$commit}",
),
$text);
}
final public function linkHistory($path) {
$drequest = $this->getDiffusionRequest();
if ($drequest->getRawCommit()) {
$commit = ';'.$drequest->getCommitURIComponent($drequest->getRawCommit());
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.$path;
$text = 'History';
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/history/{$path}{$commit}",
),
$text);
}
final public function linkBrowse($path, array $details = array()) {
$drequest = $this->getDiffusionRequest();
$raw_commit = idx($details, 'commit', $drequest->getRawCommit());
if ($raw_commit) {
$commit = ';'.$drequest->getCommitURIComponent($raw_commit);
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.$path;
if (isset($details['text'])) {
$text = phutil_escape_html($details['text']);
} else {
$text = 'Browse';
}
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/browse/{$path}{$commit}",
),
$text);
}
final public static function linkCommit($repository, $commit) {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
- $commit_name = substr($commit, 0, 16);
+ case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
+ $commit_name = substr($commit, 0, 12);
break;
default:
$commit_name = $commit;
break;
}
$callsign = $repository->getCallsign();
$commit_name = "r{$callsign}{$commit_name}";
return phutil_render_tag(
'a',
array(
'href' => "/r{$callsign}{$commit}",
),
$commit_name);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 23:37 (6 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129974
Default Alt Text
(10 KB)

Event Timeline