跳转到主内容

Mercurial

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

在 Mercurial 仓库中时显示 Mercurial 相关信息。为确保最佳兼容性, 请确保您的 hg 可执行文件保持最新(例如当分支或状态信息显示异常时)。

示例配置

{
"type": "mercurial",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"options": {
"fetch_status": true,
"native_fallback": false
}
}

选项

信息获取

由于执行 Mercurial (hg) 命令可能降低提示符响应速度,默认不主动获取信息。您可设置 fetch_statustrue 来启用额外信息获取(并填充模板)。

NameTypeDefaultDescription
fetch_statusbooleanfalsefetch the local changes
native_fallbackbooleanfalsewhen set to true and hg.exe is not available when inside a WSL2 shared Windows drive, we will fallback to the native hg executable to fetch data. Not all information can be displayed in this case
status_formatsmap[string]stringa key, value map allowing to override how individual status items are displayed. For example, "status_formats": { "Added": "Added: %d" } will display the added count as Added: 1 instead of +1. See the Status section for available overrides

模板 (信息)

默认模板
hg {{.Branch}} {{if .LocalCommitNumber}}({{.LocalCommitNumber}}:{{.ChangeSetIDShort}}){{end}}{{range .Bookmarks }} \uf02e {{.}}{{end}}{{range .Tags}} \uf02b {{.}}{{end}}{{if .Working.Changed}} \uf044 {{ .Working.String }}{{ end }}

属性

NameTypeDescription
.WorkingStatuschanges in the worktree (see below)
.IsTipbooleanCurrent commit is the tip commit
.ChangeSetIDstringThe current local commit number
.ChangeSetIDShortstringThe current local commit number
.Branchstringcurrent branch
.Bookmarks[]stringthe currently checked out revision number
.Tags[]stringthe currently checked out revision number

状态标识

NameTypeDescription
.Untrackedintnumber of files not under version control
.Modifiedintnumber of modified files
.Deletedintnumber of deleted files
.Addedintnumber of added files
.Changedbooleanif the status contains changes or not
.Stringstringa string representation of the changes above

本地变更使用以下语法表示:

IconDescription
?Untracked
~Modified
-Deleted
+Added