Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14388305
D9094.id21633.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
D9094.id21633.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -530,6 +530,7 @@
'DiffusionPushLogListController' => 'applications/diffusion/controller/DiffusionPushLogListController.php',
'DiffusionQuery' => 'applications/diffusion/query/DiffusionQuery.php',
'DiffusionRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionRawDiffQuery.php',
+ 'DiffusionRefNotFoundException' => 'applications/diffusion/exception/DiffusionRefNotFoundException.php',
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
'DiffusionRepositoryCreateController' => 'applications/diffusion/controller/DiffusionRepositoryCreateController.php',
@@ -3172,6 +3173,7 @@
),
'DiffusionQuery' => 'PhabricatorQuery',
'DiffusionRawDiffQuery' => 'DiffusionQuery',
+ 'DiffusionRefNotFoundException' => 'Exception',
'DiffusionRepositoryController' => 'DiffusionController',
'DiffusionRepositoryCreateController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryDefaultController' => 'DiffusionController',
diff --git a/src/applications/diffusion/exception/DiffusionRefNotFoundException.php b/src/applications/diffusion/exception/DiffusionRefNotFoundException.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/exception/DiffusionRefNotFoundException.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionRefNotFoundException extends Exception {
+
+ private $ref;
+
+ public function setRef($ref) {
+ $this->ref = $ref;
+ return $this;
+ }
+
+ public function getRef() {
+ return $this->ref;
+ }
+
+}
diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php
--- a/src/applications/diffusion/request/DiffusionRequest.php
+++ b/src/applications/diffusion/request/DiffusionRequest.php
@@ -4,11 +4,8 @@
* Contains logic to parse Diffusion requests, which have a complicated URI
* structure.
*
- *
* @task new Creating Requests
* @task uri Managing Diffusion URIs
- *
- * @group diffusion
*/
abstract class DiffusionRequest {
@@ -644,17 +641,18 @@
}
if ($this->getSupportsBranches()) {
- $branch = $this->getResolvableBranchName($this->getBranch());
+ $ref = $this->getResolvableBranchName($this->getBranch());
} else {
- $branch = 'HEAD';
+ $ref = 'HEAD';
}
- $results = $this->resolveRefs(array($branch));
+ $results = $this->resolveRefs(array($ref));
- $matches = idx($results, $branch, array());
+ $matches = idx($results, $ref, array());
if (count($matches) !== 1) {
- throw new Exception(
- pht('Ref "%s" is ambiguous or does not exist.', $branch));
+ $message = pht('Ref "%s" is ambiguous or does not exist.', $ref);
+ throw id(new DiffusionRefNotFoundException($message))
+ ->setRef($ref);
}
$this->stableCommit = idx(head($matches), 'identifier');
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 4:04 PM (11 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6918903
Default Alt Text
D9094.id21633.diff (3 KB)
Attached To
Mode
D9094: Throw a more tailored exception after failing to resolve a ref
Attached
Detach File
Event Timeline
Log In to Comment