Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102626016
D46804.id146087.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46804.id146087.diff
View Options
diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -155,6 +155,49 @@
exit 1
}
+printf_color()
+{
+ local sgr
+
+ color=$1
+ shift
+
+ case $color in
+ black)
+ sgr="\033[30m"
+ ;;
+ red)
+ sgr="\033[31m"
+ ;;
+ green)
+ sgr="\033[32m"
+ ;;
+ yellow)
+ sgr="\033[33m"
+ ;;
+ blue)
+ sgr="\033[34m"
+ ;;
+ magenta)
+ sgr="\033[35m"
+ ;;
+ cyan)
+ sgr="\033[36m"
+ ;;
+ white)
+ sgr="\033[37m"
+ ;;
+ *)
+ sgr="\033[0m"
+ ;;
+ esac
+
+ printf "%b" "$sgr"
+ # shellcheck disable=SC2059
+ printf "$@"
+ printf "\033[0m"
+}
+
# Use xmktemp instead of mktemp when creating temporary files.
xmktemp()
{
@@ -207,7 +250,7 @@
diff2status()
{
- local diff tmp status summary
+ local diff tmp phid status status_color status_name summary
diff=$1
if ! expr "$diff" : 'D[1-9][0-9]*$' >/dev/null; then
@@ -217,10 +260,20 @@
tmp=$(xmktemp)
echo '{"names":["'"$diff"'"]}' |
arc_call_conduit -- phid.lookup > "$tmp"
- status=$(jq -r "select(.response != []) | .response.${diff}.status" < "$tmp")
+ phid=$(jq -r ".response[].phid" "$tmp")
+ if [ -z "$phid" ] || [ "$phid" = "null" ]; then
+ err "invalid Phabricator ID for ${diff}"
+ fi
+
+ status=$(printf "%s" '{"constraints": {"phids": ["'"$phid"'"]}}' | \
+ arc_call_conduit -- differential.revision.search | \
+ jq -r '.response.data[0].fields.status')
+ status_name=$(echo "$status" | jq -r '.name')
+ status_color=$(echo "$status" | jq -r '."color.ansi"')
summary=$(jq -r "select(.response != []) |
.response.${diff}.fullName" < "$tmp")
- printf "%-14s %s\n" "${status}" "${summary}"
+ printf_color "$status_color" "%-15s" "$status_name"
+ printf " %s\n" "${summary}"
}
log2diff()
@@ -472,7 +525,7 @@
awk -F'D[1-9][0-9]*: ' \
'{if ($2 == "'"$(echo $title | sed 's/"/\\"/g')"'") print $0}')
if [ -z "$diff" ]; then
- echo "No Review : $title"
+ echo "No Review : $title"
elif [ "$(echo "$diff" | wc -l)" -ne 1 ]; then
printf "%s" "Ambiguous Reviews: "
echo "$diff" | grep -E -o 'D[1-9][0-9]*:' | tr -d ':' \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 12:21 AM (8 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14501873
Default Alt Text
D46804.id146087.diff (2 KB)
Attached To
Mode
D46804: git-arc: Improve 'list' when a review exists
Attached
Detach File
Event Timeline
Log In to Comment