b3d1826a431028acdbbae1eb5242f5641da17788

Author
Kirk <1652877+chenkirk@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

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.

Diff

 1diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
 2index 89d5355dc952450157b8e04a48b5ba797dec9f41..95067060b480d769f3800fadfc7a8d321de18d5a 100644
 3--- a/themes/ys.zsh-theme
 4+++ b/themes/ys.zsh-theme
 5@@ -26,10 +26,12 @@ ys_hg_prompt_info() {
 6 	if [ -d '.hg' ]; then
 7 		echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}"
 8 		echo -n $(hg branch 2>/dev/null)
 9-		if [ -n "$(hg status 2>/dev/null)" ]; then
10-			echo -n "$YS_VCS_PROMPT_DIRTY"
11-		else
12-			echo -n "$YS_VCS_PROMPT_CLEAN"
13+		if [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then
14+			if [ -n "$(hg status 2>/dev/null)" ]; then
15+				echo -n "$YS_VCS_PROMPT_DIRTY"
16+			else
17+				echo -n "$YS_VCS_PROMPT_CLEAN"
18+			fi
19 		fi
20 		echo -n "$YS_VCS_PROMPT_SUFFIX"
21 	fi