The Simplest Way to Make Bitbucket and Mercurial Work Like They Should
Running bitbucket and mercurial in production means bridging modern cloud repos with legacy version control. Teams use conversion bridges or self-hosted mirrors to sync commits and run build pipelines. Since Bitbucket dropped native Mercurial hosting, engineering teams still maintain older Mercurial codebases alongside Git. You need a clear workflow to move code, verify users, and trigger automated builds. How bitbucket and mercurial share identity and code In a hybrid setup, developers writ
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 bitbucket and mercurial in production means bridging modern cloud repos with legacy version control. Teams use conversion bridges or self-hosted mirrors to sync commits and run build pipelines.
Since Bitbucket dropped native Mercurial hosting, engineering teams still maintain older Mercurial codebases alongside Git. You need a clear workflow to move code, verify users, and trigger automated builds.
How bitbucket and mercurial share identity and code
In a hybrid setup, developers write code in a local Mercurial repo. A bridge tool converts those commits into Git format and pushes them to Bitbucket. This flow lets teams keep their local habits while using Bitbucket for pull requests.
User login between the two systems relies on SSH keys or app tokens. Each developer or build worker needs a valid key to push changes upstream. The bridge maps Mercurial commit authors to Bitbucket user accounts during the sync step.
Permissions live in two places during this process. Local Mercurial hooks check rules before a commit leaves the developer machine. Bitbucket branch rules then check the pushed code before merging it into the main branch.
Build servers also read from both tools during test runs. The server pulls the latest changes, runs the test suite, and posts status updates back. Clear role mappings keep this data moving without manual fixes.
Common failure modes in hybrid repo setups
The biggest risk in this workflow is a shared service account. Teams often use one broad token to run the sync script between repos. If that token leaks, an attacker gains write rights to every project.
Shared accounts also ruin your audit logs. When a script pushes all commits under one bot name, you lose track of who did what. Security teams cannot trace a bad change back to a single person.
End-to-End Encryption + Bitbucket Pipelines Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Another common issue is unlogged admin actions on the self-hosted Mercurial server. Engineers often log into the repo host over SSH to fix broken sync states. Without command logging, no one knows what changes happened on that disk.
Broad network paths make these problems worse. Opening the Mercurial host to the public internet invites constant brute-force attacks. You should lock down network routes so only known build workers can reach the host.
Scoping roles and network paths for legacy repos
Start by removing shared admin tokens from your sync scripts. Give each build worker and bridge job its own narrow role. Scope each token so it can only read or write to one specific repo.
Next, match your Mercurial server permissions to your identity provider groups. When a developer leaves the team, removing their central account should block their repo access right away. Never leave orphaned SSH keys sitting on a repo server.
You should also protect sensitive data inside commit logs and hooks. If a script queries a database during a build, data masking rewrites matched fields in results. Masking emails, phone numbers, card numbers, or national IDs keeps test logs clean.
Finally, restrict how admins reach the underlying Mercurial host. Require engineers to log in through their central identity before running server repair commands. Keep a full log of every shell command run on the repo machine.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Does Bitbucket still host Mercurial repos directly?
No, Bitbucket removed native Mercurial support from its cloud service several years ago. Teams now convert their repos to Git or run a local Mercurial mirror that syncs to Bitbucket.
How do we preserve commit history when syncing to Bitbucket?
Use a fast-export conversion tool or a bidirectional bridge plugin on your local repo. Map every Mercurial author string to a valid Bitbucket user email before running the push.
How can we secure SSH access to a self-hosted Mercurial server?
Replace static SSH keys with short-lived access tied to your central identity provider. Log every session and scope user roles to the exact repos each person needs.
Related guides
In this post