phacility/phabricator · warning · PhabricatorSearchConstraintException
Mercurial does not currently support searching for ancestors
Error message
Mercurial does not currently support searching for ancestors of a particular ref.
What it means
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.
Source
Thrown at src/applications/diffusion/query/DiffusionCommitQuery.php:583
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withIDs(array($repository_id))
->executeOne();
if (!$repository) {
throw new PhabricatorEmptyQueryException();
}
if ($repository->isSVN()) {
throw new PhabricatorSearchConstraintException(
pht(
'Subversion does not support searching for ancestors of '.
'a particular ref. This operation is not meaningful in '.
'Subversion.'));
}
if ($repository->isHg()) {
throw new PhabricatorSearchConstraintException(
pht(
'Mercurial does not currently support searching for ancestors of '.
'a particular ref.'));
}
$can_constrain = true;
$history_identifiers = array();
foreach ($this->ancestorsOf as $key => $ref) {
try {
$raw_history = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
DiffusionRequest::newFromDictionary(
array(
'repository' => $repository,
'user' => $viewer,
)),
'diffusion.historyquery',
array(View on GitHub (pinned to 5720a38cfe)
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
Defensive patterns
Strategy: validation
Validate before calling
if ($repository->isHg()) {
// hide or reject the ancestors-of filter until support ships
} Type guard
function supportsAncestorSearch(PhabricatorRepository $repository) {
return !$repository->isSVN() && !$repository->isHg();
} Try / catch
try {
$results = $query->execute();
} catch (PhabricatorSearchConstraintException $ex) {
// explain the feature is git-only today; suggest path/author/date constraints
} Prevention
- Gate ancestor-based queries on repository VCS in shared code
- Retest hg search filters after Phabricator upgrades; support status can change
When it happens
Trigger: A commit search includes ancestorsOf, constrained to exactly one repository, and that repository is Mercurial.
Common situations: Teams migrating git-based workflows or dashboards to Mercurial repositories and expecting identical ancestor filters; shared API code that worked against git.
Related errors
- Subversion does not support searching for ancestors of a par
- Password providers can't be linked.
- Mercurial command appears to contain unsafe injected "--conf
- Unknown Mercurial command "%s"!
- To search for commits which are ancestors of particular refs
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/cb52daffab575cce.
Report an issue: GitHub.