The Simplest Way to Make Mercurial and Phabricator Work Like They Should
Running mercurial and phabricator together creates a structured pipeline for distributed version control and pre-commit code review. Developers write code in local Mercurial repos and send. Changesets to Phabricator for team inspection. Pushing to central servers. This workflow keeps the main repo clean and enforces review policies across engineering teams. When configured well, these two systems track every line of code from local draft to production release. Still, connecting a distributed ve
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Running mercurial and phabricator together creates a structured pipeline for distributed version control and pre-commit code review. Developers write code in local Mercurial repos and send. Changesets to Phabricator for team inspection. Pushing to central servers.
This workflow keeps the main repo clean and enforces review policies across engineering teams. When configured well, these two systems track every line of code from local draft to production release. Still, connecting a distributed version control tool to a central review platform requires clear rules for identity. Network routing, and repo state.
How authentication and data flow between mercurial and phabricator
Data moves between the developer workstation. The review server the central repo host in two main phases. First, a developer creates a local commit in Mercurial. A client tool extracts the commit metadata, diff content, and branch context. The client sends this payload over HTTPS to the Phabricator API.
Login during this review phase relies on user API tokens or SSH keys mapped to single accounts on the review server phabricator validates the token, creates a revision record, and notifies reviewers at this stage, the central Mercurial repo does not hold the new code yet.
Once reviewers approve the revision, the second phase begins. The developer formats the local commit with the review metadata and pushes the changeset to the central Mercurial server phabricator then polls the central repo or receives a webhook notification. It reads the commit log, matches the revision ID, and closes the review ticket.
If Phabricator hosts the Mercurial repo itself. It acts as the SSH or HTTPS endpoint for both review submissions and code pushes. It maps the incoming SSH key or HTTP token to an internal user account then it checks repo policy rules before writing the changeset to disk.
Common failure modes and how to scope roles and network paths
Many teams run into trouble when they use shared service accounts to sync external Mercurial servers with Phabricator. When a single admin token handles all repo reads and writes, audit trails vanish. You can no longer tell whether a human developer or A background daemon pushed a change.
Broad API tokens create another risk. Developers often generate permanent tokens on their laptops to submit patches if an attacker steals a laptop, that broad token grants access to read private diffs and alter review states across all projects.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged repo queries and local history rewrites also break the link between the two tools. Mercurial tracks history using changeset hashes and phase states if a developer mutates a commit locally without updating the review server the two systems fall out of sync. Reviewers end up reading outdated code. The developer pushes a different changeset to production.
To prevent these failures. Separate human access from machine sync accounts. Give Phabricator a read-only SSH key or scoped token. It mirrors an external Mercurial host. It only needs to read commit logs and diffs. Not write to the upstream repo.
Enforce server-side hooks on the central Mercurial. Repo to verify review state. Accepting a push. The hook should query the review API to confirm that the exact changeset hash has an approved status. Scope network paths so that only the review server and authorized. Developer networks can reach the central repo host.
Managing repository phases and branch policies
Mercurial uses phases to track whether a commit is a local draft or a public history record. When integrating with a review system, your workflow must respect these phases. Local changes under review should stay in the draft phase until they land in the central repo.
Once a commit reaches the central server its phase changes to public public commits cannot be modified or deleted without breaking clones across the engineering team by tying Phabricator approval rules to phase transitions. Teams prevent unreviewed drafts from becoming permanent public history.
Rotate client API tokens on a strict. Schedule and revoke keys. Engineers change roles. Keep repo read and write grants inside central identity groups. Single repo settings. This structure makes grants predictable as your codebase grows.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
How does Phabricator track rewritten Mercurial commits during review?
The client workflow embeds a unique revision ID into the local commit message or metadata. When a developer updates the local changeset and submits a new diff. Phabricator matches that ID and stacks the new diff onto the existing review thread.
Should Phabricator host the Mercurial repository or mirror an external server?
Hosting the repo directly inside Phabricator simplifies. Grants and server-side hooks. One system controls both reviews and pushes. Mirroring an external server works well. You already have an established repo host, provided you use read-only sync keys.
How do we stop developers from pushing unreviewed Mercurial commits?
Configure a pre-commit or pre-push hook on the central Mercurial server that inspects incoming changesets. The hook checks the revision ID against the Phabricator API and rejects. The push if the revision lacks an approved status.
Related guides
In this post