From ef2c9861ef41df68f657799497ed69798e053e51 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 21 Jan 2014 14:02:48 -0800 Subject: [PATCH] Add yet more unit tests for Subversion Summary: Ref T4327. This adds a subpath/partial repository where we import only a subdirectory, and adds tests for it. Test Plan: Ran unit tests. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4327 Differential Revision: https://secure.phabricator.com/D8019 --- .../engine/__tests__/data/CHD.svn.tgz | Bin 0 -> 9437 bytes .../PhabricatorChangeParserTestCase.php | 109 +++++++++++++++++- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/applications/repository/engine/__tests__/data/CHD.svn.tgz diff --git a/src/applications/repository/engine/__tests__/data/CHD.svn.tgz b/src/applications/repository/engine/__tests__/data/CHD.svn.tgz new file mode 100644 index 0000000000000000000000000000000000000000..0a4d0a5700414b36e6c72445d35dc7310d9f464a GIT binary patch literal 9437 zcmV<3BqG}%iwFR|;N4OH1MPiTa~w&M9@*q{@0Qt`$yN{hI3ciY3TV}pR~=}>YB40b zn<5EN0LY%1UWyx;8CA$(R%T5e0E-&QOfs4DBlH9GTlAtQ{RaJoebIy5JtB`fzye5A zksM^O*#t5pBRo9ZJwEriTJ1Y)Pn}Mu*Xc0&w`}ws>C#1@Aix?ys%hD(=Efi z!>sj_cIQqSCp-dD#3b@WocLn8JRf8m4&PIbYDfO>7m`|SCk%$`6$0#c%eqeg8)na_ z`hOFt)pqT5n*iw4EBC+N>tO$DMz8AsO{7+P7)E2Btg{Z_hiRJc>wkS-|9d9%e`lRU zW$Bjpzg7Fx6jbR`rdInb4By0S9RfaJ{O|U(%KmR6wc38@e1`qst@?i>sntF{*njlw zpq0E`8wLP=bl*4r8>Tha|E6wstMPvm>GaHt8T`lDNot>qDE7jDMPd@hUJ^#r?^zlP zmYfMzkIw_{j=iAHk}&k)e@wjP@VlsaNsF;ZAq&EUao24ySNI|k4Hiah9J=0c%7&gV zVs<7X!O{SJjM+3y*_$A|U}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#e^p>C(wF;k=QT zKGyRRnoTuE)QO*d7`~B&l31xr)VPZhT`$@---QUI&pF^>uq~~6jmE|%vM{^0ZgEV> z)IiE=>|xX5Boe_WIm<_1;iO=rrvQkjB2sov-ZUtgPP9PNCQ*3qxu9wtHWnQ3-weUh zInk6VYcNedmhuoJVuYnOi6PiB9F-f{U<9CkL|2@FYoO84;)Id9e^8PjwO zHz2saB%IKAUNPGitx*fWUSE*~KQ(Q2GhvZ!r$wTx>c4zQ!+Xn0h3~NrKICs_AL>^3 jFA1?%sY+F!@Tho%1y9M%tP02l!P;I_kn literal 0 HcmV?d00001 diff --git a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php index 616de159d4..54bbdd74c8 100644 --- a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php +++ b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php @@ -952,6 +952,110 @@ final class PhabricatorChangeParserTestCase )); } + public function testSubversionPartialParser() { + $repository = $this->buildBareRepository('CHD'); + $repository->setDetail('svn-subpath', 'trunk/'); + + id(new PhabricatorRepositoryPullEngine()) + ->setRepository($repository) + ->pullRepository(); + + id(new PhabricatorRepositoryDiscoveryEngine()) + ->setRepository($repository) + ->discoverCommits($repository); + + $viewer = PhabricatorUser::getOmnipotentUser(); + + $commits = id(new DiffusionCommitQuery()) + ->setViewer($viewer) + ->withRepositoryIDs(array($repository->getID())) + ->execute(); + + $this->expectChanges( + $repository, + $commits, + array( + // Copy of a file outside of the subpath from an earlier revision + // into the subpath. + 4 => array( + array( + '/', + null, + null, + DifferentialChangeType::TYPE_CHILD, + DifferentialChangeType::FILE_DIRECTORY, + 0, + 4, + ), + array( + '/goat', + null, + null, + DifferentialChangeType::TYPE_COPY_AWAY, + DifferentialChangeType::FILE_NORMAL, + 0, + 4, + ), + array( + '/trunk', + null, + null, + DifferentialChangeType::TYPE_CHILD, + DifferentialChangeType::FILE_DIRECTORY, + 0, + 4, + ), + array( + '/trunk/goat', + '/goat', + '1', + DifferentialChangeType::TYPE_COPY_HERE, + DifferentialChangeType::FILE_NORMAL, + 1, + 4, + ), + ), + 3 => array( + array( + '/', + null, + null, + DifferentialChangeType::TYPE_CHILD, + DifferentialChangeType::FILE_DIRECTORY, + 0, + 3, + ), + array( + '/trunk', + null, + null, + DifferentialChangeType::TYPE_ADD, + DifferentialChangeType::FILE_DIRECTORY, + 1, + 3, + ), + array( + '/trunk/apple', + null, + null, + DifferentialChangeType::TYPE_ADD, + DifferentialChangeType::FILE_NORMAL, + 1, + 3, + ), + array( + '/trunk/banana', + null, + null, + DifferentialChangeType::TYPE_ADD, + DifferentialChangeType::FILE_NORMAL, + 1, + 3, + ), + ), + )); + } + private function expectChanges( PhabricatorRepository $repository, array $commits, @@ -1023,7 +1127,10 @@ final class PhabricatorChangeParserTestCase ksort($dicts); ksort($expect_changes); - $this->assertEqual($expect_changes, $dicts); + $this->assertEqual( + $expect_changes, + $dicts, + pht('Commit %s', $commit_identifier)); } }