# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper, scoop, winget, chocolatey 安装 mercurial

查看 mercurial 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:mercurial
```

## 代理安全回答

mercurial mutates source-control repositories and remote history.

- **凭据访问:** Reads repository config, credential helpers, auth files, and local history.
- **远程变更:** Can push changesets, tags, bookmarks, and remote repository changes.
- **发布/制品风险:** Can publish source changes and release tags.
- **推荐控制:** Gate pushes, credential reads, destructive history operations, and tag creation.
- **代理使用指南:** Allow status/log/diff; require approval for pushes, credential use, and history rewrites.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install mercurial
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install mercurial
```

  证据: MacPorts ports tree: devel/mercurial/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add mercurial
```

  证据: Alpine Linux edge package indexes: mercurial from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install mercurial
```

  证据: Debian stable package indexes: mercurial from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install mercurial
```

  证据: Fedora Rawhide package metadata: mercurial from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#mercurial
```

  证据: nixpkgs package indexes: pkgs/by-name/me/mercurial/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S mercurial
```

  证据: Arch Linux sync databases: mercurial from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install mercurial
```

  证据: openSUSE Tumbleweed package metadata: mercurial from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/mercurial
```

  证据: Scoop official bucket manifest trees: bucket/mercurial.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id Mercurial.Mercurial -e
```

  证据: Windows Package Manager source index: Mercurial.Mercurial from https://cdn.winget.microsoft.com/cache/source.msix

- Chocolatey (92%):

```sh
choco install hg
```

  证据: Chocolatey community package catalog: hg from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','handbrake.install'

## 软件包事实

- **软件包键:** brew:mercurial
- **软件包管理器:** Homebrew
- **版本:** 7.2.3
- **来源摘要:** Scalable distributed version control system
- **主页:** <https://mercurial-scm.org/>
- **最后更新:** 2026-06-29T18:50:44Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- chg (别名)
- hg (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 7.2.3
## 项目历史与用法

Mercurial is a distributed source-control management system invoked mainly through the hg command. Matt Mackall, later Olivia Mackall, started it in April 2005 after Linux kernel developers lost the free BitKeeper arrangement. The Architecture of Open Source Applications describes Mercurial and Git as parallel 2005 responses to the need for a scalable distributed VCS capable of handling large kernel-sized histories; it also notes Mackall's early goals of simplicity, scalability, and efficiency.

### 项目历史

Technically, Mercurial stores project history as a distributed graph of changesets. Like Git, it uses SHA-1-derived changeset identifiers, but it emphasizes a comparatively small, coherent command set and a clone model where most operations are local. The official Mercurial site positions it as a free distributed SCM that handles projects of any size, supports many workflows, and can be extended.

### 采用历史

Mercurial's adoption history is strongly tied to large repositories and to teams that valued a scriptable CLI with a less sprawling user model than Git. Facebook selected Mercurial while replacing a Subversion server plus Git mirror, then published work on scaling it for a repository with thousands of weekly commits and hundreds of thousands of files. That scaling lineage later connected to Mononoke and Sapling: Meta's Sapling README says Sapling's CLI was originally based on Mercurial and shares aspects of Mercurial's UI and features, while Mononoke is described as a Mercurial source-control server for large monorepos.

### 使用方式

For package managers, Mercurial is a classic cross-platform developer tool rather than an application-specific CLI. It appears across Homebrew, Debian, Ubuntu, Fedora, Arch, Nix, MacPorts, Windows package managers, and others, with hg as the primary executable and chg as a command server client for faster repeated commands.

### 来源

- <https://aosabook.org/en/v1/mercurial.html>
- <https://engineering.fb.com/2014/01/07/core-infra/scaling-mercurial-at-facebook/>
- <https://github.com/facebook/sapling>
- <https://github.com/facebookarchive/mononoke>
- <https://www.mercurial-scm.org/>


## 安全说明

没有找到 mercurial 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。



## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.hgrc, $XDG_CONFIG_HOME/hg/hgrc, ~/.config/hg/hgrc

## Credential files

- Unix: ~/.hgrc, $XDG_CONFIG_HOME/hg/hgrc, ~/.config/hg/hgrc
## 其他软件包管理器记录

- Debian apt - mercurial - 7.0.1-2: normalized package name match | Debian stable package indexes: mercurial from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | easy-to-use, scalable distributed version control system | https://www.mercurial-scm.org/
- Debian apt - mercurial-common - 7.0.1-2: normalized package name match | Debian stable package indexes: mercurial-common from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | easy-to-use, scalable distributed version control system (common files) | https://www.mercurial-scm.org/
- Nix - mercurial: normalized package name match | nixpkgs package indexes: pkgs/by-name/me/mercurial/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - mercurial - 6.7.2-1ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: mercurial from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | easy-to-use, scalable distributed version control system | https://www.mercurial-scm.org/
- Ubuntu apt - mercurial-common - 6.7.2-1ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: mercurial-common from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | easy-to-use, scalable distributed version control system (common files) | https://www.mercurial-scm.org/
- apk - mercurial - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Scalable distributed SCM tool | https://www.mercurial-scm.org/
- apk - mercurial-bash-completion - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Bash completions for mercurial | https://www.mercurial-scm.org/
- apk - mercurial-chg - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-chg from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Client for Mercurial command server with cHg extension | https://www.mercurial-scm.org/
- apk - mercurial-doc - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Scalable distributed SCM tool (documentation) | https://www.mercurial-scm.org/
- apk - mercurial-lang - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-lang from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | translations for mercurial | https://www.mercurial-scm.org/
- apk - mercurial-pyc - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-pyc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Precompiled Python bytecode for mercurial | https://www.mercurial-scm.org/
- apk - mercurial-vim - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-vim from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Vim syntax for mercurial | https://www.mercurial-scm.org/
- apk - mercurial-zsh-completion - 7.2.3-r0: normalized package name match | Alpine Linux edge package indexes: mercurial-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for mercurial | https://www.mercurial-scm.org/
- dnf - mercurial - 7.2.3-5.fc45: normalized package name match | Fedora Rawhide package metadata: mercurial from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | A fast, lightweight Source Control Management system | https://mercurial-scm.org/
- dnf - mercurial-chg - 7.2.3-5.fc45: normalized package name match | Fedora Rawhide package metadata: mercurial-chg from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | A fast Mercurial command without slow Python startup | https://mercurial-scm.org/
- dnf - mercurial-hgk - 7.2.3-5.fc45: normalized package name match | Fedora Rawhide package metadata: mercurial-hgk from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Hgk interface for mercurial | https://mercurial-scm.org/


## Combined YAML source

View the package source record on GitHub. [combined/mercurial.yml](https://github.com/mxcl/pkgdb/blob/main/combined/mercurial.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
