Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistBackoutWorkflow.php
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | $revisions = $conduit->callMethodSynchronous( | ||||
| array( | array( | ||||
| 'ids' => array($revision_id), | 'ids' => array($revision_id), | ||||
| )); | )); | ||||
| if (!$revisions) { | if (!$revisions) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| 'The revision you provided does not exist!'); | 'The revision you provided does not exist!'); | ||||
| } | } | ||||
| $revision = $revisions[0]; | $revision = $revisions[0]; | ||||
| $commits = $revision["commits"]; | $commits = $revision['commits']; | ||||
| if (!$commits) { | if (!$commits) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| 'This revision has not been committed yet!'); | 'This revision has not been committed yet!'); | ||||
| } | } | ||||
| elseif (count($commits) > 1) { | else if (count($commits) > 1) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| 'The revision you provided has multiple commits!'); | 'The revision you provided has multiple commits!'); | ||||
| } | } | ||||
| $commit_phid = $commits[0]; | $commit_phid = $commits[0]; | ||||
| $commit = $conduit->callMethodSynchronous( | $commit = $conduit->callMethodSynchronous( | ||||
| 'phid.query', | 'phid.query', | ||||
| array( | array( | ||||
| 'phids' => array($commit_phid), | 'phids' => array($commit_phid), | ||||
| )); | )); | ||||
| $commit_id = $commit[$commit_phid]["name"]; | $commit_id = $commit[$commit_phid]['name']; | ||||
| return $commit_id; | return $commit_id; | ||||
| } | } | ||||
| // Fetches an array of commit info provided a Commit_id | // Fetches an array of commit info provided a Commit_id | ||||
| // in the form of rE123456 (not local commit hash) | // in the form of rE123456 (not local commit hash) | ||||
| private function getDiffusionCommit($commit_id) { | private function getDiffusionCommit($commit_id) { | ||||
| $result = $this->getConduit()->callMethodSynchronous( | $result = $this->getConduit()->callMethodSynchronous( | ||||
| 'diffusion.getcommits', | 'diffusion.getcommits', | ||||
| array( | array( | ||||
| 'commits' => array($commit_id), | 'commits' => array($commit_id), | ||||
| )); | )); | ||||
| $commit = $result[$commit_id]; | $commit = $result[$commit_id]; | ||||
| // This commit was not found in Diffusion | // This commit was not found in Diffusion | ||||
| if (array_key_exists("error", $commit)) { | if (array_key_exists('error', $commit)) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return $commit; | return $commit; | ||||
| } | } | ||||
| // Retrieves default template from differential and prefills info | // Retrieves default template from differential and prefills info | ||||
| private function buildCommitMessage($commit_hash) { | private function buildCommitMessage($commit_hash) { | ||||
| $conduit = $this->getConduit(); | $conduit = $this->getConduit(); | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||