Page MenuHomePhabricator

D14736.id35644.diff
No OneTemporary

D14736.id35644.diff

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

Mime Type
text/plain
Expires
Wed, Mar 12, 1:19 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587511
Default Alt Text
D14736.id35644.diff (1 KB)

Event Timeline