Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15412754
D14736.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
D14736.diff
View Options
diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php
--- a/src/workflow/ArcanistDiffWorkflow.php
+++ b/src/workflow/ArcanistDiffWorkflow.php
@@ -531,6 +531,7 @@
$this->updateLintDiffProperty();
$this->updateUnitDiffProperty();
$this->updateLocalDiffProperty();
+ $this->updateOntoDiffProperty();
$this->resolveDiffPropertyUpdates();
$output_json = $this->getArgument('json');
@@ -2406,6 +2407,54 @@
$this->updateDiffProperty('local:commits', json_encode($local_info));
}
+ private function updateOntoDiffProperty() {
+ $onto = $this->getDiffOntoTargets();
+
+ if (!$onto) {
+ return;
+ }
+
+ $this->updateDiffProperty('arc:onto', json_encode($onto));
+ }
+
+ private function getDiffOntoTargets() {
+ $api = $this->getRepositoryAPI();
+
+ if (!($api instanceof ArcanistGitAPI)) {
+ return null;
+ }
+
+ // If we track an upstream branch either directly or indirectly, use that.
+ $branch = $api->getBranchName();
+ if (strlen($branch)) {
+ $upstream_path = $api->getPathToUpstream($branch);
+ $remote_branch = $upstream_path->getRemoteBranchName();
+ if (strlen($remote_branch)) {
+ return array(
+ array(
+ 'type' => 'branch',
+ 'name' => $remote_branch,
+ 'kind' => 'upstream',
+ ),
+ );
+ }
+ }
+
+ // If "arc.land.onto.default" is configured, use that.
+ $config_key = 'arc.land.onto.default';
+ $onto = $this->getConfigFromAnySource($config_key);
+ if (strlen($onto)) {
+ return array(
+ array(
+ 'type' => 'branch',
+ 'name' => $onto,
+ 'kind' => 'arc.land.onto.default',
+ ),
+ );
+ }
+
+ return null;
+ }
/**
* Update an arbitrary diff property.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 2:43 PM (2 d, 22 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587511
Default Alt Text
D14736.diff (1 KB)
Attached To
Mode
D14736: In `arc diff`, try to guess where a change should land
Attached
Detach File
Event Timeline
Log In to Comment