Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2024 02:24:28 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: df834e06bbc7 - main - git-arc: Just strip escape sequences form arc log
Message-ID:  <202401150224.40F2OSBS093537@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=df834e06bbc78c03cb6b35f074ae43673c9ce463

commit df834e06bbc78c03cb6b35f074ae43673c9ce463
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-01-15 02:22:04 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-01-15 02:23:45 +0000

    git-arc: Just strip escape sequences form arc log
    
    Just strip escape sequences and Warning: lines from 'arc list' output. I
    upgraded and they changed and git arc list broke. This restores its
    functionality.
    
    Note: jhb didn't like this, so if others object, I'll fix...
    
    Sponsored by:           Netflix
    Reviewed by:            markj
    Differential Revision:  https://reviews.freebsd.org/D36553
---
 tools/tools/git/git-arc.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index d06d6be3d41e..a207899d5fbe 100644
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -142,6 +142,15 @@ __EOF__
     exit 1
 }
 
+#
+# Filter the output of arc list to remove the warnings as above, as well as any
+# stray escape sequences that are in the list (it interferes with the parsing)
+#
+arc_list()
+{
+    arc list "$@" | sed 's/\x1b\[[0-9;]*m//g' | grep -v '^Warning: '
+}
+
 diff2phid()
 {
     local diff
@@ -194,8 +203,7 @@ title2diff()
     local title
 
     title=$(echo $1 | sed 's/"/\\"/g')
-    # arc list output always includes ANSI escape sequences, strip them.
-    arc list | sed 's/\x1b\[[0-9;]*m//g' | \
+    arc_list |
         awk -F': ' '{
             if (substr($0, index($0, FS) + length(FS)) == "'"$title"'") {
                 print substr($1, match($1, "D[1-9][0-9]*"))
@@ -406,7 +414,7 @@ gitarc__list()
     local chash commit commits diff openrevs title
 
     commits=$(build_commit_list "$@")
-    openrevs=$(arc list)
+    openrevs=$(arc_list)
 
     for commit in $commits; do
         chash=$(git show -s --format='%C(auto)%h' "$commit")
@@ -422,7 +430,7 @@ gitarc__list()
         # differently and keep the entire status.
         title=$(git show -s --format=%s "$commit")
         diff=$(echo "$openrevs" | \
-            awk -F'D[1-9][0-9]*:\.\\[m ' \
+            awk -F'D[1-9][0-9]*: ' \
                 '{if ($2 == "'"$(echo $title | sed 's/"/\\"/g')"'") print $0}')
         if [ -z "$diff" ]; then
             echo "No Review      : $title"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401150224.40F2OSBS093537>