Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistLandEngine.php
| Show First 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | if ($unauthored) { | ||||
| echo tsprintf( | echo tsprintf( | ||||
| "\n%!\n%W\n\n", | "\n%!\n%W\n\n", | ||||
| pht('NOT REVISION AUTHOR'), | pht('NOT REVISION AUTHOR'), | ||||
| pht( | pht( | ||||
| 'You are landing revisions which you ("%s") are not the author of:', | 'You are landing revisions which you ("%s") are not the author of:', | ||||
| $viewer->getMonogram())); | $viewer->getMonogram())); | ||||
| foreach ($unauthored as $revision_ref) { | foreach ($unauthored as $revision_ref) { | ||||
| $display_ref = $revision_ref->newDisplayRef(); | $display_ref = $revision_ref->newRefView(); | ||||
| $author_ref = $revision_ref->getAuthorRef(); | $author_ref = $revision_ref->getAuthorRef(); | ||||
| if ($author_ref) { | if ($author_ref) { | ||||
| $display_ref->appendLine( | $display_ref->appendLine( | ||||
| pht( | pht( | ||||
| 'Author: %s', | 'Author: %s', | ||||
| $author_ref->getMonogram())); | $author_ref->getMonogram())); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if ($planned) { | ||||
| 'update the revision with revised changes; or use '. | 'update the revision with revised changes; or use '. | ||||
| '"Request Review" from the web interface.', | '"Request Review" from the web interface.', | ||||
| phutil_count($planned)), | phutil_count($planned)), | ||||
| pht( | pht( | ||||
| 'These %s revision(s) have changes planned:', | 'These %s revision(s) have changes planned:', | ||||
| phutil_count($planned))); | phutil_count($planned))); | ||||
| foreach ($planned as $revision_ref) { | foreach ($planned as $revision_ref) { | ||||
| echo tsprintf('%s', $revision_ref->newDisplayRef()); | echo tsprintf('%s', $revision_ref->newRefView()); | ||||
| } | } | ||||
| $query = pht( | $query = pht( | ||||
| 'Land %s revision(s) with changes planned?', | 'Land %s revision(s) with changes planned?', | ||||
| phutil_count($planned)); | phutil_count($planned)); | ||||
| $this->getWorkflow() | $this->getWorkflow() | ||||
| ->getPrompt('arc.land.changes-planned') | ->getPrompt('arc.land.changes-planned') | ||||
| Show All 12 Lines | if ($published) { | ||||
| pht('%s REVISION(S) ARE ALREADY PUBLISHED', phutil_count($published)), | pht('%s REVISION(S) ARE ALREADY PUBLISHED', phutil_count($published)), | ||||
| pht( | pht( | ||||
| 'You are landing %s revision(s) which are already in the state '. | 'You are landing %s revision(s) which are already in the state '. | ||||
| '"%s", indicating that they have previously landed:', | '"%s", indicating that they have previously landed:', | ||||
| phutil_count($published), | phutil_count($published), | ||||
| $example_ref->getStatusDisplayName())); | $example_ref->getStatusDisplayName())); | ||||
| foreach ($published as $revision_ref) { | foreach ($published as $revision_ref) { | ||||
| echo tsprintf('%s', $revision_ref->newDisplayRef()); | echo tsprintf('%s', $revision_ref->newRefView()); | ||||
| } | } | ||||
| $query = pht( | $query = pht( | ||||
| 'Land %s revision(s) that are already published?', | 'Land %s revision(s) that are already published?', | ||||
| phutil_count($published)); | phutil_count($published)); | ||||
| $this->getWorkflow() | $this->getWorkflow() | ||||
| ->getPrompt('arc.land.published') | ->getPrompt('arc.land.published') | ||||
| Show All 10 Lines | if ($not_accepted) { | ||||
| pht( | pht( | ||||
| 'You are landing %s revision(s) which are not in state "Accepted", '. | 'You are landing %s revision(s) which are not in state "Accepted", '. | ||||
| 'indicating that they have not been accepted by reviewers. '. | 'indicating that they have not been accepted by reviewers. '. | ||||
| 'Normally, you should land changes only once they have been '. | 'Normally, you should land changes only once they have been '. | ||||
| 'accepted. These revisions are in the wrong state:', | 'accepted. These revisions are in the wrong state:', | ||||
| phutil_count($not_accepted))); | phutil_count($not_accepted))); | ||||
| foreach ($not_accepted as $revision_ref) { | foreach ($not_accepted as $revision_ref) { | ||||
| $display_ref = $revision_ref->newDisplayRef(); | $display_ref = $revision_ref->newRefView(); | ||||
| $display_ref->appendLine( | $display_ref->appendLine( | ||||
| pht( | pht( | ||||
| 'Status: %s', | 'Status: %s', | ||||
| $revision_ref->getStatusDisplayName())); | $revision_ref->getStatusDisplayName())); | ||||
| echo tsprintf('%s', $display_ref); | echo tsprintf('%s', $display_ref); | ||||
| } | } | ||||
| $query = pht( | $query = pht( | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if ($open_parents) { | ||||
| 'The changes you are landing depend on %s open parent revision(s). '. | 'The changes you are landing depend on %s open parent revision(s). '. | ||||
| 'Usually, you should land parent revisions before landing the '. | 'Usually, you should land parent revisions before landing the '. | ||||
| 'changes which depend on them. These parent revisions are open:', | 'changes which depend on them. These parent revisions are open:', | ||||
| phutil_count($open_parents))); | phutil_count($open_parents))); | ||||
| foreach ($open_parents as $parent_phid => $spec) { | foreach ($open_parents as $parent_phid => $spec) { | ||||
| $parent_ref = $spec['ref']; | $parent_ref = $spec['ref']; | ||||
| $display_ref = $parent_ref->newDisplayRef(); | $display_ref = $parent_ref->newRefView(); | ||||
| $display_ref->appendLine( | $display_ref->appendLine( | ||||
| pht( | pht( | ||||
| 'Status: %s', | 'Status: %s', | ||||
| $parent_ref->getStatusDisplayName())); | $parent_ref->getStatusDisplayName())); | ||||
| foreach ($spec['children'] as $child_ref) { | foreach ($spec['children'] as $child_ref) { | ||||
| $display_ref->appendLine( | $display_ref->appendLine( | ||||
| ▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | if ($has_failures) { | ||||
| $query = pht( | $query = pht( | ||||
| 'Land %s revision(s) anyway, despite ongoing builds?', | 'Land %s revision(s) anyway, despite ongoing builds?', | ||||
| phutil_count($build_map)); | phutil_count($build_map)); | ||||
| $prompt_key = 'arc.land.ongoing-builds'; | $prompt_key = 'arc.land.ongoing-builds'; | ||||
| } | } | ||||
| $workflow = $this->getWorkflow(); | |||||
| echo tsprintf("\n"); | echo tsprintf("\n"); | ||||
| foreach ($build_map as $build_item) { | foreach ($build_map as $build_item) { | ||||
| $revision_ref = $build_item['revisionRef']; | $revision_ref = $build_item['revisionRef']; | ||||
| $revision_view = $revision_ref->newRefView(); | |||||
| $buildable_ref = $revision_ref->getBuildableRef(); | |||||
| $buildable_view = $buildable_ref->newRefView(); | |||||
| $raw_uri = $buildable_ref->getURI(); | |||||
| $raw_uri = $workflow->getAbsoluteURI($raw_uri); | |||||
| $buildable_view->setURI($raw_uri); | |||||
| echo tsprintf('%s', $revision_ref->newDisplayRef()); | $revision_view->addChild($buildable_view); | ||||
| foreach ($build_item['buildRefs'] as $build_ref) { | foreach ($build_item['buildRefs'] as $build_ref) { | ||||
| echo tsprintf('%s', $build_ref->newDisplayRef()); | $build_view = $build_ref->newRefView(); | ||||
| $buildable_view->addChild($build_view); | |||||
| } | } | ||||
| echo tsprintf('%s', $revision_view); | |||||
| echo tsprintf("\n"); | echo tsprintf("\n"); | ||||
| } | } | ||||
| echo tsprintf( | |||||
| "\n%s\n", | |||||
| pht('You can review build details here:')); | |||||
| // TODO: Only show buildables with problem builds. | |||||
| $workflow = $this->getWorkflow(); | |||||
| foreach ($buildable_refs as $buildable) { | |||||
| $display_ref = $buildable->newDisplayRef(); | |||||
| $raw_uri = $buildable->getURI(); | |||||
| $raw_uri = $workflow->getAbsoluteURI($raw_uri); | |||||
| $display_ref->setURI($raw_uri); | |||||
| echo tsprintf('%s', $display_ref); | |||||
| } | |||||
| $this->getWorkflow() | $this->getWorkflow() | ||||
| ->getPrompt($prompt_key) | ->getPrompt($prompt_key) | ||||
| ->setQuery($query) | ->setQuery($query) | ||||
| ->execute(); | ->execute(); | ||||
| } | } | ||||
| final protected function confirmImplicitCommits(array $sets, array $symbols) { | final protected function confirmImplicitCommits(array $sets, array $symbols) { | ||||
| assert_instances_of($sets, 'ArcanistLandCommitSet'); | assert_instances_of($sets, 'ArcanistLandCommitSet'); | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | final protected function getDisplaySymbols(array $symbols) { | ||||
| return implode(', ', $display); | return implode(', ', $display); | ||||
| } | } | ||||
| final protected function printCommitSet(ArcanistLandCommitSet $set) { | final protected function printCommitSet(ArcanistLandCommitSet $set) { | ||||
| $revision_ref = $set->getRevisionRef(); | $revision_ref = $set->getRevisionRef(); | ||||
| echo tsprintf( | echo tsprintf( | ||||
| "\n%s", | "\n%s", | ||||
| $revision_ref->newDisplayRef()); | $revision_ref->newRefView()); | ||||
| foreach ($set->getCommits() as $commit) { | foreach ($set->getCommits() as $commit) { | ||||
| $is_implicit = $commit->getIsImplicitCommit(); | $is_implicit = $commit->getIsImplicitCommit(); | ||||
| $display_hash = $this->getDisplayHash($commit->getHash()); | $display_hash = $this->getDisplayHash($commit->getHash()); | ||||
| $display_summary = $commit->getDisplaySummary(); | $display_summary = $commit->getDisplaySummary(); | ||||
| if ($is_implicit) { | if ($is_implicit) { | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | if ($ambiguous) { | ||||
| 'commit:', | 'commit:', | ||||
| $display_hash, | $display_hash, | ||||
| implode(', ', $raw_symbols), | implode(', ', $raw_symbols), | ||||
| phutil_count($revision_refs))); | phutil_count($revision_refs))); | ||||
| foreach ($revision_refs as $revision_ref) { | foreach ($revision_refs as $revision_ref) { | ||||
| echo tsprintf( | echo tsprintf( | ||||
| '%s', | '%s', | ||||
| $revision_ref->newDisplayRef()); | $revision_ref->newRefView()); | ||||
| } | } | ||||
| echo tsprintf("\n"); | echo tsprintf("\n"); | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht( | pht( | ||||
| 'Revision for commit "%s" is ambiguous. Use "--revision" to force '. | 'Revision for commit "%s" is ambiguous. Use "--revision" to force '. | ||||
| 'selection of a particular revision.', | 'selection of a particular revision.', | ||||
| ▲ Show 20 Lines • Show All 601 Lines • Show Last 20 Lines | |||||