Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892332
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/conduit/method/differential/getdiff/ConduitAPI_differential_getdiff_Method.php b/src/applications/conduit/method/differential/getdiff/ConduitAPI_differential_getdiff_Method.php
index 5745d182ce..dab997866d 100644
--- a/src/applications/conduit/method/differential/getdiff/ConduitAPI_differential_getdiff_Method.php
+++ b/src/applications/conduit/method/differential/getdiff/ConduitAPI_differential_getdiff_Method.php
@@ -1,94 +1,94 @@
<?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.
*/
/**
* @group conduit
*/
class ConduitAPI_differential_getdiff_Method extends ConduitAPIMethod {
public function getMethodDescription() {
return "Load the content of a diff from Differential.";
}
public function defineParamTypes() {
return array(
'revision_id' => 'optional id',
'diff_id' => 'optional id',
);
}
public function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array(
'ERR_BAD_REVISION' => 'No such revision exists.',
'ERR_BAD_DIFF' => 'No such diff exists.',
);
}
public function shouldRequireAuthentication() {
return !PhabricatorEnv::getEnvConfig('differential.anonymous-access');
}
protected function execute(ConduitAPIRequest $request) {
$diff = null;
$revision_id = $request->getValue('revision_id');
if ($revision_id) {
$revision = id(new DifferentialRevision())->load($revision_id);
if (!$revision) {
throw new ConduitException('ERR_BAD_REVISION');
}
$diff = id(new DifferentialDiff())->loadOneWhere(
'revisionID = %d ORDER BY id DESC LIMIT 1',
$revision->getID());
} else {
$diff_id = $request->getValue('diff_id');
if ($diff_id) {
$diff = id(new DifferentialDiff())->load($diff_id);
}
}
if (!$diff) {
throw new ConduitException('ERR_BAD_DIFF');
}
$diff->attachChangesets($diff->loadChangesets());
// TODO: We could batch this to improve performance.
foreach ($diff->getChangesets() as $changeset) {
$changeset->attachHunks($changeset->loadHunks());
}
$basic_dict = $diff->getDiffDict();
// for conduit calls, the basic dict is not enough
// we also need to include the arcanist project
$project = $diff->loadArcanistProject();
if ($project) {
$project_name = $project->getName();
} else {
- $project_name = '';
+ $project_name = null;
}
$basic_dict['projectName'] = $project_name;
return $basic_dict;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 16:38 (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126555
Default Alt Text
(3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment