diff options
author | Kirk <1652877+chenkirk@users.noreply.github.com> | 2021-04-23 06:22:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 15:22:18 +0200 |
commit | b3d1826a431028acdbbae1eb5242f5641da17788 (patch) | |
tree | ae6b2720163b51c507d89dc8b2b6f88ae58cd21a /themes/ys.zsh-theme | |
parent | 12669f29f0843b8b980dd137f150a74511f88842 (diff) | |
download | zsh-b3d1826a431028acdbbae1eb5242f5641da17788.tar.gz zsh-b3d1826a431028acdbbae1eb5242f5641da17788.tar.bz2 zsh-b3d1826a431028acdbbae1eb5242f5641da17788.zip |
feat(ys): add setting to hide dirty info in hg repositories (#8415)
On large mercurial projects, using `hg status` to show dirty prompt
causes significant delay.
This commit checks a local hg config value of `oh-my-zsh.hide-dirty` to
skip dirty check.
Users who wish to skip dirty check can add this to their `.hg/hgrc`
file.
```
[oh-my-zsh]
hide-dirty = 1
```
This config value uses the same naming as ones found for git, in file
lib/git.zsh.
Diffstat (limited to 'themes/ys.zsh-theme')
-rw-r--r-- | themes/ys.zsh-theme | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 89d5355dc..95067060b 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -26,10 +26,12 @@ ys_hg_prompt_info() { if [ -d '.hg' ]; then echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" echo -n $(hg branch 2>/dev/null) - if [ -n "$(hg status 2>/dev/null)" ]; then - echo -n "$YS_VCS_PROMPT_DIRTY" - else - echo -n "$YS_VCS_PROMPT_CLEAN" + if [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then + if [ -n "$(hg status 2>/dev/null)" ]; then + echo -n "$YS_VCS_PROMPT_DIRTY" + else + echo -n "$YS_VCS_PROMPT_CLEAN" + fi fi echo -n "$YS_VCS_PROMPT_SUFFIX" fi |