mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 00:42:40 +01:00
Rename "getWorkingCopy()" to "getWorkingCopyIdentity()" in Arcanist
Summary: Depends on D21074. Ref T13490. Ref T11968. Before toolsets, Arcanist has a "WorkingCopyIdentity" object. After toolsets, it has a "WorkingCopy" object. Most workflows don't access either one, so make a slightly-breaking API change to simplify the transition. - "getWorkingCopy()" now returns a modern object (a "WorkingCopy"). - "getWorkingCopyIdentity()" now returns an older object (a "WorkingCopyIdentity"). This isn't backward-compatible, but out-of-date code should get an explicit failure with clear resolution steps. Test Plan: Ran "arc lint", "arc branch", and a few other commands. Grepped for "getWorkingCopy()". Maniphest Tasks: T13490, T11968 Differential Revision: https://secure.phabricator.com/D21075
This commit is contained in:
parent
391c164313
commit
92b29f53f3
5 changed files with 25 additions and 10 deletions
|
@ -46,8 +46,6 @@ EOHELP
|
|||
}
|
||||
|
||||
public function runWorkflow() {
|
||||
$working_copy = $this->getWorkingCopy();
|
||||
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
if (!$repository_api) {
|
||||
throw new PhutilArgumentUsageException(
|
||||
|
|
|
@ -52,7 +52,7 @@ EOTEXT
|
|||
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 =>
|
||||
|
|
|
@ -146,7 +146,7 @@ EOTEXT
|
|||
|
||||
public function run() {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$working_copy = $this->getWorkingCopy();
|
||||
$working_copy = $this->getWorkingCopyIdentity();
|
||||
$configuration_manager = $this->getConfigurationManager();
|
||||
|
||||
$engine = $this->newLintEngine($this->getArgument('engine'));
|
||||
|
|
|
@ -128,7 +128,7 @@ EOTEXT
|
|||
}
|
||||
|
||||
public function run() {
|
||||
$working_copy = $this->getWorkingCopy();
|
||||
$working_copy = $this->getWorkingCopyIdentity();
|
||||
|
||||
$paths = $this->getArgument('paths');
|
||||
$rev = $this->getArgument('rev');
|
||||
|
|
|
@ -895,6 +895,23 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
|
||||
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 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
}
|
||||
|
||||
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 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
* @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 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
* @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 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
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 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
$query->setRepositoryRef($repository_ref);
|
||||
}
|
||||
|
||||
$working_copy = $this->getWorkingCopy();
|
||||
$working_copy = $this->getWorkingCopyIdentity();
|
||||
if ($working_copy) {
|
||||
$working_ref = $this->newWorkingCopyStateRef();
|
||||
$query->setWorkingCopyRef($working_ref);
|
||||
|
|
Loading…
Reference in a new issue