{"record":{"id":"cb52daffab575cce","repo":"phacility/phabricator","slug":"mercurial-does-not-currently-support-searching-for","errorCode":null,"errorMessage":"Mercurial does not currently support searching for ancestors of a particular ref.","messagePattern":"Mercurial does not currently support searching for ancestors of a particular ref\\.","errorType":"validation","errorClass":"PhabricatorSearchConstraintException","httpStatus":null,"severity":"warning","filePath":"src/applications/diffusion/query/DiffusionCommitQuery.php","lineNumber":583,"sourceCode":"      $repository = id(new PhabricatorRepositoryQuery())\n        ->setViewer($viewer)\n        ->withIDs(array($repository_id))\n        ->executeOne();\n\n      if (!$repository) {\n        throw new PhabricatorEmptyQueryException();\n      }\n\n      if ($repository->isSVN()) {\n        throw new PhabricatorSearchConstraintException(\n          pht(\n            'Subversion does not support searching for ancestors of '.\n            'a particular ref. This operation is not meaningful in '.\n            'Subversion.'));\n      }\n\n      if ($repository->isHg()) {\n        throw new PhabricatorSearchConstraintException(\n          pht(\n            'Mercurial does not currently support searching for ancestors of '.\n            'a particular ref.'));\n      }\n\n      $can_constrain = true;\n      $history_identifiers = array();\n      foreach ($this->ancestorsOf as $key => $ref) {\n        try {\n          $raw_history = DiffusionQuery::callConduitWithDiffusionRequest(\n            $viewer,\n            DiffusionRequest::newFromDictionary(\n              array(\n                'repository' => $repository,\n                'user' => $viewer,\n              )),\n            'diffusion.historyquery',\n            array(","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/diffusion/query/DiffusionCommitQuery.php#L565-L601","documentation":"The same ancestors-of-refs constraint applied to a Mercurial repository: unlike SVN it is conceptually possible, but Phabricator's implementation ('does not currently support') does not cover it, so the search is blocked with PhabricatorSearchConstraintException.","triggerScenarios":"A commit search includes ancestorsOf, constrained to exactly one repository, and that repository is Mercurial.","commonSituations":"Teams migrating git-based workflows or dashboards to Mercurial repositories and expecting identical ancestor filters; shared API code that worked against git.","solutions":["Drop the ancestors-of filter for Mercurial repositories and use paths, authors, or date constraints instead","Track the upstream feature request; support may arrive in a newer Phabricator release, so retest after upgrades","Branch shared query code on repository VCS before applying ancestor constraints"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if ($repository->isHg()) {\n  // hide or reject the ancestors-of filter until support ships\n}","typeGuard":"function supportsAncestorSearch(PhabricatorRepository $repository) {\n  return !$repository->isSVN() && !$repository->isHg();\n}","tryCatchPattern":"try {\n  $results = $query->execute();\n} catch (PhabricatorSearchConstraintException $ex) {\n  // explain the feature is git-only today; suggest path/author/date constraints\n}","preventionTips":["Gate ancestor-based queries on repository VCS in shared code","Retest hg search filters after Phabricator upgrades; support status can change"],"tags":["mercurial","search","unsupported-operation","phabricator"],"backgroundTag":"unsupported-vcs-operation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}