diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php --- a/src/workflow/ArcanistFeatureWorkflow.php +++ b/src/workflow/ArcanistFeatureWorkflow.php @@ -46,8 +46,6 @@ } public function runWorkflow() { - $working_copy = $this->getWorkingCopy(); - $repository_api = $this->getRepositoryAPI(); if (!$repository_api) { throw new PhutilArgumentUsageException( diff --git a/src/workflow/ArcanistGetConfigWorkflow.php b/src/workflow/ArcanistGetConfigWorkflow.php --- a/src/workflow/ArcanistGetConfigWorkflow.php +++ b/src/workflow/ArcanistGetConfigWorkflow.php @@ -52,7 +52,7 @@ ArcanistConfigurationManager::CONFIG_SOURCE_LOCAL => $configuration_manager->readLocalArcConfig(), ArcanistConfigurationManager::CONFIG_SOURCE_PROJECT => - $this->getWorkingCopy()->readProjectConfig(), + $this->getWorkingCopyIdentity()->readProjectConfig(), ArcanistConfigurationManager::CONFIG_SOURCE_USER => $configuration_manager->readUserArcConfig(), ArcanistConfigurationManager::CONFIG_SOURCE_SYSTEM => diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -146,7 +146,7 @@ public function run() { $console = PhutilConsole::getConsole(); - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); $configuration_manager = $this->getConfigurationManager(); $engine = $this->newLintEngine($this->getArgument('engine')); diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php --- a/src/workflow/ArcanistUnitWorkflow.php +++ b/src/workflow/ArcanistUnitWorkflow.php @@ -128,7 +128,7 @@ } public function run() { - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); $paths = $this->getArgument('paths'); $rev = $this->getArgument('rev'); diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -895,6 +895,23 @@ final public function getWorkingCopy() { $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) { $working_copy = $configuration_engine->getWorkingCopy(); $working_path = $working_copy->getWorkingDirectory(); @@ -1573,7 +1590,7 @@ } if ($paths) { - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); foreach ($paths as $key => $path) { $full_path = Filesystem::resolvePath($path); if (!Filesystem::pathExists($full_path)) { @@ -2012,7 +2029,7 @@ * @return ArcanistLintEngine Constructed engine. */ protected function newLintEngine($engine_class = null) { - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); $config = $this->getConfigurationManager(); if (!$engine_class) { @@ -2063,7 +2080,7 @@ * @return ArcanistUnitTestEngine Constructed engine. */ protected function newUnitTestEngine($engine_class = null) { - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); $config = $this->getConfigurationManager(); if (!$engine_class) { @@ -2234,7 +2251,7 @@ final protected function newWorkingCopyStateRef() { $ref = new ArcanistWorkingCopyStateRef(); - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); $ref->setRootDirectory($working_copy->getProjectRoot()); return $ref; @@ -2256,7 +2273,7 @@ $query->setRepositoryRef($repository_ref); } - $working_copy = $this->getWorkingCopy(); + $working_copy = $this->getWorkingCopyIdentity(); if ($working_copy) { $working_ref = $this->newWorkingCopyStateRef(); $query->setWorkingCopyRef($working_ref);