Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891230
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
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
index eff49c60a3..05f71da352 100644
--- a/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
@@ -1,42 +1,63 @@
<?php
final class ConduitAPI_differential_createrawdiff_Method
extends ConduitAPI_differential_Method {
public function getMethodDescription() {
- return "Create a new Differential diff from a raw diff source.";
+ return pht("Create a new Differential diff from a raw diff source.");
}
public function defineParamTypes() {
return array(
'diff' => 'required string',
+ 'repositoryPHID' => 'optional string',
);
}
public function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
$raw_diff = $request->getValue('diff');
+ $repository_phid = $request->getValue('repositoryPHID');
+ if ($repository_phid) {
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
+ if (!$repository) {
+ throw new Exception(
+ pht('No such repository "%s"!', $repository_phid));
+ }
+ } else {
+ $repository = null;
+ }
+
$parser = new ArcanistDiffParser();
$changes = $parser->parseDiff($raw_diff);
$diff = DifferentialDiff::newFromRawChanges($changes);
$diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setUnitStatus(DifferentialUnitStatus::UNIT_SKIP);
- $diff->setAuthorPHID($request->getUser()->getPHID());
+ $diff->setAuthorPHID($viewer->getPHID());
$diff->setCreationMethod('web');
+
+ if ($repository) {
+ $diff->setRepositoryPHID($repository->getPHID());
+ }
+
$diff->save();
return $this->buildDiffInfoDictionary($diff);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 14:52 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125686
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment