From 964707ffdfa8b61e1e25c776eb0ed15d5a2cba60 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 27 Sep 2018 10:32:23 -0700 Subject: [PATCH] [Wilds] Make "Base Commit" parser test cases pass Summary: Ref T13098. Chip away at test cases: update the tests for `base` rule parsing for the new WorkingCopy objects. Test Plan: Ran `arc unit`, saw fewer test failures. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13098 Differential Revision: https://secure.phabricator.com/D19712 --- .../__tests__/ArcanistBaseCommitParserTestCase.php | 10 ++++------ src/workingcopy/ArcanistGitWorkingCopy.php | 4 ++++ src/workingcopy/ArcanistMercurialWorkingCopy.php | 4 ++++ src/workingcopy/ArcanistSubversionWorkingCopy.php | 4 ++++ src/workingcopy/ArcanistWorkingCopy.php | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/parser/__tests__/ArcanistBaseCommitParserTestCase.php b/src/parser/__tests__/ArcanistBaseCommitParserTestCase.php index 5d6b11d2..609595b6 100644 --- a/src/parser/__tests__/ArcanistBaseCommitParserTestCase.php +++ b/src/parser/__tests__/ArcanistBaseCommitParserTestCase.php @@ -150,13 +150,11 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase { // isolation for repository-oriented test cases. $root = dirname(phutil_get_library_root('arcanist')); - $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); - $configuration_manager = new ArcanistConfigurationManager(); - $configuration_manager->setWorkingCopyIdentity($working_copy); - $repo = ArcanistRepositoryAPI::newAPIFromConfigurationManager( - $configuration_manager); + $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root); - return new ArcanistBaseCommitParser($repo); + $api = $working_copy->newRepositoryAPI(); + + return new ArcanistBaseCommitParser($api); } } diff --git a/src/workingcopy/ArcanistGitWorkingCopy.php b/src/workingcopy/ArcanistGitWorkingCopy.php index 9cb157e7..820912ad 100644 --- a/src/workingcopy/ArcanistGitWorkingCopy.php +++ b/src/workingcopy/ArcanistGitWorkingCopy.php @@ -18,5 +18,9 @@ final class ArcanistGitWorkingCopy return new self(); } + public function newRepositoryAPI() { + return new ArcanistGitAPI($this->getPath()); + } + } diff --git a/src/workingcopy/ArcanistMercurialWorkingCopy.php b/src/workingcopy/ArcanistMercurialWorkingCopy.php index f062270f..b5df4b62 100644 --- a/src/workingcopy/ArcanistMercurialWorkingCopy.php +++ b/src/workingcopy/ArcanistMercurialWorkingCopy.php @@ -18,5 +18,9 @@ final class ArcanistMercurialWorkingCopy return new self(); } + public function newRepositoryAPI() { + return new ArcanistMercurialAPI($this->getPath()); + } + } diff --git a/src/workingcopy/ArcanistSubversionWorkingCopy.php b/src/workingcopy/ArcanistSubversionWorkingCopy.php index e14e7a60..6c4cefed 100644 --- a/src/workingcopy/ArcanistSubversionWorkingCopy.php +++ b/src/workingcopy/ArcanistSubversionWorkingCopy.php @@ -70,5 +70,9 @@ final class ArcanistSubversionWorkingCopy return head($candidates); } + public function newRepositoryAPI() { + return new ArcanistSubversionAPI($this->getPath()); + } + } diff --git a/src/workingcopy/ArcanistWorkingCopy.php b/src/workingcopy/ArcanistWorkingCopy.php index c7b9632c..3a6a8ced 100644 --- a/src/workingcopy/ArcanistWorkingCopy.php +++ b/src/workingcopy/ArcanistWorkingCopy.php @@ -110,4 +110,6 @@ abstract class ArcanistWorkingCopy return last($candidates); } + abstract public function newRepositoryAPI(); + }