Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
| Show First 20 Lines • Show All 889 Lines • ▼ Show 20 Lines | /* -( Conduit )------------------------------------------------------------ */ | ||||
| } | } | ||||
| protected function didParseArguments() { | protected function didParseArguments() { | ||||
| // Override this to customize workflow argument behavior. | // Override this to customize workflow argument behavior. | ||||
| } | } | ||||
| final public function getWorkingCopy() { | final public function getWorkingCopy() { | ||||
| $configuration_engine = $this->getConfigurationEngine(); | $configuration_engine = $this->getConfigurationEngine(); | ||||
| // TOOLSETS: Remove this once all workflows are toolset workflows. | |||||
| if (!$configuration_engine) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'This workflow has not yet been updated to Toolsets and can '. | |||||
| 'not retrieve a modern WorkingCopy object. Use '. | |||||
| '"getWorkingCopyIdentity()" to retrieve a previous-generation '. | |||||
| 'object.')); | |||||
| } | |||||
| return $configuration_engine->getWorkingCopy(); | |||||
| } | |||||
| final public function getWorkingCopyIdentity() { | |||||
| $configuration_engine = $this->getConfigurationEngine(); | |||||
| if ($configuration_engine) { | if ($configuration_engine) { | ||||
| $working_copy = $configuration_engine->getWorkingCopy(); | $working_copy = $configuration_engine->getWorkingCopy(); | ||||
| $working_path = $working_copy->getWorkingDirectory(); | $working_path = $working_copy->getWorkingDirectory(); | ||||
| return ArcanistWorkingCopyIdentity::newFromPath($working_path); | return ArcanistWorkingCopyIdentity::newFromPath($working_path); | ||||
| } | } | ||||
| $working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | $working_copy = $this->getConfigurationManager()->getWorkingCopyIdentity(); | ||||
| ▲ Show 20 Lines • Show All 662 Lines • ▼ Show 20 Lines | final protected function selectPathsForWorkflow( | ||||
| $rev, | $rev, | ||||
| $omit_mask = null) { | $omit_mask = null) { | ||||
| if ($omit_mask === null) { | if ($omit_mask === null) { | ||||
| $omit_mask = ArcanistRepositoryAPI::FLAG_UNTRACKED; | $omit_mask = ArcanistRepositoryAPI::FLAG_UNTRACKED; | ||||
| } | } | ||||
| if ($paths) { | if ($paths) { | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopyIdentity(); | ||||
| foreach ($paths as $key => $path) { | foreach ($paths as $key => $path) { | ||||
| $full_path = Filesystem::resolvePath($path); | $full_path = Filesystem::resolvePath($path); | ||||
| if (!Filesystem::pathExists($full_path)) { | if (!Filesystem::pathExists($full_path)) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| "Path '%s' does not exist!", | "Path '%s' does not exist!", | ||||
| $path)); | $path)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | /* -( Phabricator Repositories )------------------------------------------- */ | ||||
| * Optionally, you can pass an explicit engine class name to build an engine | * Optionally, you can pass an explicit engine class name to build an engine | ||||
| * of a particular class. Normally this is used to implement an `--engine` | * of a particular class. Normally this is used to implement an `--engine` | ||||
| * flag from the CLI. | * flag from the CLI. | ||||
| * | * | ||||
| * @param string Optional explicit engine class name. | * @param string Optional explicit engine class name. | ||||
| * @return ArcanistLintEngine Constructed engine. | * @return ArcanistLintEngine Constructed engine. | ||||
| */ | */ | ||||
| protected function newLintEngine($engine_class = null) { | protected function newLintEngine($engine_class = null) { | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopyIdentity(); | ||||
| $config = $this->getConfigurationManager(); | $config = $this->getConfigurationManager(); | ||||
| if (!$engine_class) { | if (!$engine_class) { | ||||
| $engine_class = $config->getConfigFromAnySource('lint.engine'); | $engine_class = $config->getConfigFromAnySource('lint.engine'); | ||||
| } | } | ||||
| if (!$engine_class) { | if (!$engine_class) { | ||||
| if (Filesystem::pathExists($working_copy->getProjectPath('.arclint'))) { | if (Filesystem::pathExists($working_copy->getProjectPath('.arclint'))) { | ||||
| Show All 34 Lines | /* -( Phabricator Repositories )------------------------------------------- */ | ||||
| * Optionally, you can pass an explicit engine class name to build an engine | * Optionally, you can pass an explicit engine class name to build an engine | ||||
| * of a particular class. Normally this is used to implement an `--engine` | * of a particular class. Normally this is used to implement an `--engine` | ||||
| * flag from the CLI. | * flag from the CLI. | ||||
| * | * | ||||
| * @param string Optional explicit engine class name. | * @param string Optional explicit engine class name. | ||||
| * @return ArcanistUnitTestEngine Constructed engine. | * @return ArcanistUnitTestEngine Constructed engine. | ||||
| */ | */ | ||||
| protected function newUnitTestEngine($engine_class = null) { | protected function newUnitTestEngine($engine_class = null) { | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopyIdentity(); | ||||
| $config = $this->getConfigurationManager(); | $config = $this->getConfigurationManager(); | ||||
| if (!$engine_class) { | if (!$engine_class) { | ||||
| $engine_class = $config->getConfigFromAnySource('unit.engine'); | $engine_class = $config->getConfigFromAnySource('unit.engine'); | ||||
| } | } | ||||
| if (!$engine_class) { | if (!$engine_class) { | ||||
| if (Filesystem::pathExists($working_copy->getProjectPath('.arcunit'))) { | if (Filesystem::pathExists($working_copy->getProjectPath('.arcunit'))) { | ||||
| ▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | /* -( Phabricator Repositories )------------------------------------------- */ | ||||
| final public function getConduitEngine() { | final public function getConduitEngine() { | ||||
| return $this->conduitEngine; | return $this->conduitEngine; | ||||
| } | } | ||||
| final protected function newWorkingCopyStateRef() { | final protected function newWorkingCopyStateRef() { | ||||
| $ref = new ArcanistWorkingCopyStateRef(); | $ref = new ArcanistWorkingCopyStateRef(); | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopyIdentity(); | ||||
| $ref->setRootDirectory($working_copy->getProjectRoot()); | $ref->setRootDirectory($working_copy->getProjectRoot()); | ||||
| return $ref; | return $ref; | ||||
| } | } | ||||
| final protected function newRefQuery(array $refs) { | final protected function newRefQuery(array $refs) { | ||||
| assert_instances_of($refs, 'ArcanistRef'); | assert_instances_of($refs, 'ArcanistRef'); | ||||
| $query = id(new ArcanistRefQuery()) | $query = id(new ArcanistRefQuery()) | ||||
| ->setConduitEngine($this->getConduitEngine()) | ->setConduitEngine($this->getConduitEngine()) | ||||
| ->setRefs($refs); | ->setRefs($refs); | ||||
| if ($this->hasRepositoryAPI()) { | if ($this->hasRepositoryAPI()) { | ||||
| $query->setRepositoryAPI($this->getRepositoryAPI()); | $query->setRepositoryAPI($this->getRepositoryAPI()); | ||||
| } | } | ||||
| $repository_ref = $this->getRepositoryRef(); | $repository_ref = $this->getRepositoryRef(); | ||||
| if ($repository_ref) { | if ($repository_ref) { | ||||
| $query->setRepositoryRef($repository_ref); | $query->setRepositoryRef($repository_ref); | ||||
| } | } | ||||
| $working_copy = $this->getWorkingCopy(); | $working_copy = $this->getWorkingCopyIdentity(); | ||||
| if ($working_copy) { | if ($working_copy) { | ||||
| $working_ref = $this->newWorkingCopyStateRef(); | $working_ref = $this->newWorkingCopyStateRef(); | ||||
| $query->setWorkingCopyRef($working_ref); | $query->setWorkingCopyRef($working_ref); | ||||
| } | } | ||||
| return $query; | return $query; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||