Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14063175
D8576.id20370.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8576.id20370.diff
View Options
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
@@ -40,6 +40,7 @@
}
protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
$change_data = $request->getValue('changes');
$changes = array();
@@ -53,7 +54,7 @@
$diff->setBranch($request->getValue('branch'));
$diff->setCreationMethod($request->getValue('creationMethod'));
- $diff->setAuthorPHID($request->getUser()->getPHID());
+ $diff->setAuthorPHID($viewer->getPHID());
$diff->setBookmark($request->getValue('bookmark'));
// TODO: Remove this eventually; for now continue writing the UUID. Note
@@ -64,7 +65,7 @@
$repository_phid = $request->getValue('repositoryPHID');
if ($repository_phid) {
$repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($request->getUser())
+ ->setViewer($viewer)
->withPHIDs(array($repository_phid))
->executeOne();
if ($repository) {
@@ -142,6 +143,22 @@
$diff->save();
+ // If we didn't get an explicit `repositoryPHID` (which means the client is
+ // old, or couldn't figure out which repository the working copy belongs
+ // to), apply heuristics to try to figure it out.
+
+ if (!$repository_phid) {
+ $repository = id(new DifferentialRepositoryLookup())
+ ->setDiff($diff)
+ ->setViewer($viewer)
+ ->lookupRepository();
+ if ($repository) {
+ $diff->setRepositoryPHID($repository->getPHID());
+ $diff->setRepositoryUUID($repository->getUUID());
+ $diff->save();
+ }
+ }
+
$path = '/differential/diff/'.$diff->getID().'/';
$uri = PhabricatorEnv::getURI($path);
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -498,6 +498,7 @@
$object->setLineCount($diff->getLineCount());
$object->setRepositoryPHID($diff->getRepositoryPHID());
+ $object->setArcanistProjectPHID($diff->getArcanistProjectPHID());
return;
}
diff --git a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
--- a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
+++ b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
@@ -157,28 +157,10 @@
public function loadRepository() {
if ($this->repository === null) {
$this->repository = false;
-
- $viewer = PhabricatorUser::getOmnipotentUser();
- $repository_phid = null;
-
- $revision = $this->revision;
- if ($revision->getRepositoryPHID()) {
- $repository_phid = $revision->getRepositoryPHID();
- } else {
- $repository = id(new DifferentialRepositoryLookup())
- ->setViewer($viewer)
- ->setDiff($this->diff)
- ->lookupRepository();
- if ($repository) {
- // We want to get the projects for this repository too, so run a
- // full query for it below.
- $repository_phid = $repository->getPHID();
- }
- }
-
+ $repository_phid = $this->getObject()->getRepositoryPHID();
if ($repository_phid) {
$repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($viewer)
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs(array($repository_phid))
->needProjectPHIDs(true)
->executeOne();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 4:58 PM (5 h, 36 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6721584
Default Alt Text
D8576.id20370.diff (3 KB)
Attached To
Mode
D8576: Make Herald less ambitious about resolving repositories for revisions
Attached
Detach File
Event Timeline
Log In to Comment