Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15336522
D8133.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8133.diff
View Options
Index: src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
===================================================================
--- src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
+++ src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
@@ -1103,11 +1103,55 @@
pht('Artificial SVN root should fail.'));
}
+ public function testSubversionForeignStubsParser() {
+ $repository = $this->buildBareRepository('CHE');
+ $repository->setDetail('svn-subpath', 'branch/');
- private function expectChanges(
+ id(new PhabricatorRepositoryPullEngine())
+ ->setRepository($repository)
+ ->pullRepository();
+
+ id(new PhabricatorRepositoryDiscoveryEngine())
+ ->setRepository($repository)
+ ->discoverCommits();
+
+ $viewer = PhabricatorUser::getOmnipotentUser();
+
+ $commits = id(new DiffusionCommitQuery())
+ ->setViewer($viewer)
+ ->withRepositoryIDs(array($repository->getID()))
+ ->execute();
+
+ foreach ($commits as $commit) {
+ $this->parseCommit($repository, $commit);
+ }
+
+ // As a side effect, we expect parsing these commits to have created
+ // foreign stubs of other commits.
+
+ $commits = id(new DiffusionCommitQuery())
+ ->setViewer($viewer)
+ ->withRepositoryIDs(array($repository->getID()))
+ ->execute();
+
+ $commits = mpull($commits, null, 'getCommitIdentifier');
+
+ $this->assertEqual(
+ true,
+ isset($commits['2']),
+ 'Expect rCHE2 to exist as a foreign stub.');
+
+ // The foreign stub should be marked imported.
+
+ $commit = $commits['2'];
+ $this->assertEqual(
+ PhabricatorRepositoryCommit::IMPORTED_ALL,
+ (int)$commit->getImportStatus());
+ }
+
+ private function parseCommit(
PhabricatorRepository $repository,
- array $commits,
- array $expect) {
+ PhabricatorRepositoryCommit $commit) {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
@@ -1123,6 +1167,15 @@
throw new Exception(pht('No support yet.'));
}
+ $parser_object = newv($parser, array(array()));
+ return $parser_object->parseChangesForUnitTest($repository, $commit);
+ }
+
+ private function expectChanges(
+ PhabricatorRepository $repository,
+ array $commits,
+ array $expect) {
+
foreach ($commits as $commit) {
$commit_identifier = $commit->getCommitIdentifier();
$expect_changes = idx($expect, $commit_identifier);
@@ -1137,8 +1190,7 @@
$repository->getCallsign()));
}
- $parser_object = newv($parser, array(array()));
- $changes = $parser_object->parseChangesForUnitTest($repository, $commit);
+ $changes = $this->parseCommit($repository, $commit);
$path_map = id(new DiffusionPathQuery())
->withPathIDs(mpull($changes, 'getPathID'))
Index: src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
===================================================================
--- src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
+++ src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
@@ -509,11 +509,15 @@
"Missing commits ({$need}) in a SVN repository which is not ".
"configured for subdirectory-only parsing!");
}
+
foreach ($need as $foreign_commit) {
$commit = new PhabricatorRepositoryCommit();
$commit->setRepositoryID($repository->getID());
$commit->setCommitIdentifier($foreign_commit);
$commit->setEpoch(0);
+ // Mark this commit as imported so it doesn't prevent the repository
+ // from transitioning into the "Imported" state.
+ $commit->setImportStatus(PhabricatorRepositoryCommit::IMPORTED_ALL);
$commit->save();
$data = new PhabricatorRepositoryCommitData();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 7:19 PM (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390851
Default Alt Text
D8133.diff (3 KB)
Attached To
Mode
D8133: When creating foreign stubs during SVN import, mark them imported
Attached
Detach File
Event Timeline
Log In to Comment