phacility/phabricator · error · Exception

Missing commits (%s) in a SVN repository which is not config

Error message

Missing commits (%s) in a SVN repository which is not configured for subdirectory-only parsing!

What it means

After parsing SVN changes, the parser may need to reference commits outside the discovered set (from copies/moves across directories). That is only supported when the repository detail 'svn-subpath' is configured for subdirectory-only import, in which case foreign commits become stub rows; without it, missing commits are fatal (PhabricatorRepositorySvnCommitChangeParserWorker.php:507-517).

Source

Thrown at src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php:507

    $commit_map = ipull($commit_data, 'id', 'commitIdentifier');

    $need = array();
    foreach ($commits as $commit) {
      if (empty($commit_map[$commit])) {
        $need[] = $commit;
      }
    }

    // If we are parsing a Subversion repository and have been configured to
    // import only some subdirectory of it, we may find commits which reference
    // other foreign commits outside of the directory (for instance, because of
    // a move or copy). Rather than trying to execute full parses on them, just
    // create stub commits and identify the stubs as foreign commits.
    if ($need) {
      $subpath = $repository->getDetail('svn-subpath');
      if (!$subpath) {
        throw new Exception(
          pht(
            'Missing commits (%s) in a SVN repository which is not '.
            'configured for subdirectory-only parsing!',
            implode(', ', $need)));
      }

      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();
        $data->setCommitID($commit->getID());

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Set the repository's subdirectory import detail ('Import Only: <path>') to match the subtree actually being imported
  2. Or import the full repository so every referenced commit is discovered
  3. Re-run discovery and parsing after the configuration change
Defensive patterns

Strategy: validation

Validate before calling

// If importing a subtree, ensure the subpath detail is set before parsing.
if ($repository->getVersionControlSystem() === PhabricatorRepositoryType::REPOSITORY_TYPE_SVN
    && !$repository->getDetail('svn-subpath')) {
  // importing only part of this repo will fail on cross-directory copies;
  // set the 'Import Only' detail or import everything
}

Try / catch

try {
  $this->resolveMissingSVNCommits($repository, $need);
} catch (Exception $ex) {
  // Missing foreign commits without subdirectory config: fix the
  // repository's svn-subpath detail or import the full repository, then
  // rediscover; a retry before that fails identically.
  phlog($ex);
  throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());
}

Prevention

When it happens

Trigger: Importing only part of an SVN repository without setting the subdirectory detail, where commits contain copies from paths outside the imported subtree; or removing/altering the svn-subpath detail after the import started.

Common situations: Carving trunk-only or project-subdirectory imports out of large SVN repositories; repository layout migrations that change the subpath configuration mid-import.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/0d43dba3292d3804. Report an issue: GitHub.