Page MenuHomePhabricator

`./bin/repository parents` fails with "Unknown Commit"
Closed, ResolvedPublic

Description

Stacktrace is as follows:

> ./bin/repository parents CI
Rebuilding "rCI"...
Rebuilding branch "master"...
Rebuilding branch "X"...
Rebuilding branch "Y"...
Rebuilding branch "Z"...
Found 1,296 total commit(s); updating...
[2014-05-27 23:09:52] EXCEPTION: (Exception) Unknown commit "a1d5645eabf502a8d830c5d52e1e9f1953939957"! at [/usr/src/phabricator/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php:114]
  #0 PhabricatorRepositoryManagementParentsWorkflow::rebuildRepository(Object PhabricatorRepository) called at [/usr/src/phabricator/src/applications/repository/management/PhabricatorRepositoryManagementParentsWorkflow.php:43]
  #1 PhabricatorRepositoryManagementParentsWorkflow::execute(Object PhutilArgumentParser) called at [/usr/src/libphutil/src/parser/argument/PhutilArgumentParser.php:396]
  #2 PhutilArgumentParser::parseWorkflowsFull(Array of size 14 starting with: { PhabricatorRepositoryManagementCacheWorkflow => Object PhabricatorRepositoryManagementCacheWorkflow }) called at [/usr/src/libphutil/src/parser/argument/PhutilArgumentParser.php:292]
  #3 PhutilArgumentParser::parseWorkflows(Array of size 14 starting with: { PhabricatorRepositoryManagementCacheWorkflow => Object PhabricatorRepositoryManagementCacheWorkflow }) called at [/usr/src/phabricator/scripts/repository/manage_repositories.php:22]

Event Timeline

joshuaspence assigned this task to epriestley.
joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Repositories.
joshuaspence added a subscriber: joshuaspence.

This could happen if you have an undiscovered commit near HEAD. Does it reproduce consistently? If the issue is discovery, I'd expect running it again a few minutes later to work correctly.

I'm not so sure about that. It does reproduce consistently, even after running ./bin/repository discover CI. It's happening on quite a few repositories as well.

I have an idea on what this might be... I noticed that when I ran ./bin/repository parents, it seemed to scan more branches than I was tracking in Diffusion. When setting up the repository, I elected to only track the master branch.

Yeah, this issue seems to be related to branches that are not tracked by Diffusion. The following modification to PhabricatorRepositoryManagementParentsWorkflow works in the sense that ./bin/repository parents X no longer throws exceptions.

    foreach ($refs as $ref) {
      $console->writeOut(
        "%s\n",
        pht('Rebuilding branch "%s"...', $ref->getRefName()));

+    if ($ref->getRefName() !== 'master') { 
+      continue;
+    }
+
      $commit = $ref->getCommitIdentifier();

      if ($repo->isGit()) {
        $stream = new PhabricatorGitGraphStream($repo, $commit);
      } else {
        $stream = new PhabricatorMercurialGraphStream($repo, $commit);
      }
joshuaspence added a subscriber: epriestley.

Let me see if I can fix this.

(That all sounds reasonable/correct to me.)