Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14837998
D9023.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9023.diff
View Options
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_createrawdiff_Method.php
@@ -4,12 +4,13 @@
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',
);
}
@@ -23,8 +24,23 @@
}
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);
@@ -32,8 +48,13 @@
$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/plain
Expires
Sat, Feb 1, 12:50 PM (20 h, 45 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7078752
Default Alt Text
D9023.diff (1 KB)
Attached To
Mode
D9023: Add 'repositoryPHID' to 'differential.createrawdiff'
Attached
Detach File
Event Timeline
Log In to Comment