From 17b8c310be3979028e3ff669cf561017a46c79f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Max=20=F0=9F=91=A8=EF=BF=BD=E2=80=8D=F0=9F=92=BB=20Coplan?=
 <mchcopl@gmail.com>
Date: Fri, 17 Feb 2023 12:13:32 -0800
Subject: [PATCH] util: show all dirty status indicators (#349)

Summary:
Instead of just showing `?` or `*`, show one of each symbol in the
dirty status.  This means there will be a maximum of 5 characters at the end of
the prompt, which is fine.

Pull Request resolved: https://github.com/facebook/sapling/pull/349

Test Plan:
Seems to work:

```
fbsource>scm % setopt PROMPT_SUBST
fbsource>scm % source contrib/scm-prompt.sh
fbsource>scm % export SHOW_DIRTY_STATE=1
fbsource>scm % export PS1='$(_scm_prompt)$USER@%m:%~%% '
(158b00d6b? M)muirdm@muirdm-mbp:~/fbsource/fbcode/eden/scm%

Reviewed By: muirdm

Differential Revision: D43326525

Pulled By: quark-zju

fbshipit-source-id: 94c0a85e4cf4ffcc5c7c8db9ed64f6ea6d1564a2
---
 eden/scm/contrib/scm-prompt.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/eden/scm/contrib/scm-prompt.sh b/eden/scm/contrib/scm-prompt.sh
index bf826c30e9f4d..99b92d101219f 100644
--- a/eden/scm/contrib/scm-prompt.sh
+++ b/eden/scm/contrib/scm-prompt.sh
@@ -162,10 +162,12 @@ _hg_prompt() {
 # cf. https://www.internalfb.com/intern/qa/4964/how-do-i-show-the-mercurial-bookmarkgit-branch-in?answerID=540621130023036
 _hg_dirty() {
   if [ -n "${SHOW_DIRTY_STATE}" ] &&
-     [ "$(hg config shell.showDirtyState)" != "false" ]; then
-    command hg status 2> /dev/null \
-    | command awk '$1 == "?" { print "?" } $1 != "?" { print "*" }' \
-    | command sort | command uniq | command head -c1
+     [ "$(command sl config shell.showDirtyState)" != "false" ]; then
+       command sl status 2> /dev/null \
+         | command awk '{print $1}'\
+         | command sort\
+         | command uniq\
+         | command paste -sd ' ' -
   fi
 }