git: 067ae9850f05 - main - git-arc: -t tag support for create to set Phabricator project tags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 24 Aug 2026 21:04:49 UTC
The branch main has been updated by dteske:
URL: https://cgit.FreeBSD.org/src/commit/?id=067ae9850f05a27239c28ae5819e4016e997cff2
commit 067ae9850f05a27239c28ae5819e4016e997cff2
Author: Devin Teske <dteske@FreeBSD.org>
AuthorDate: 2026-08-24 21:02:28 +0000
Commit: Devin Teske <dteske@FreeBSD.org>
CommitDate: 2026-08-24 21:02:41 +0000
git-arc: -t tag support for create to set Phabricator project tags
Add -t tag[,...] so a review can be tagged at creation instead of
needing the web UI. Spaces in tag names are written as underscores;
a leading # is optional.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59019
---
tools/tools/git/git-arc.1 | 20 +++++++++++++++++++-
tools/tools/git/git-arc.sh | 45 ++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1
index 655f81c971c5..218d852db984 100644
--- a/tools/tools/git/git-arc.1
+++ b/tools/tools/git/git-arc.1
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd August 11, 2026
+.Dd August 20, 2026
.Dt GIT-ARC 1
.Os
.Sh NAME
@@ -36,6 +36,7 @@
.Op Fl dl
.Op Fl r Ar reviewer1 Ns Op Cm \&, Ns Ar reviewer2 ...
.Op Fl s Ar subscriber1 Ns Op Cm \&, Ns Ar subscriber2 ...
+.Op Fl t Ar tag1 Ns Op Cm \&, Ns Ar tag2 ...
.Op Fl p Ar parent
.Ar commit-ref Op Ar commit-ref ...
.Nm
@@ -114,6 +115,14 @@ hashtag (e.g. #jails for the "Jails" group).
.It Fl s Ar subscriber
Add one or more subscribers, separated by commas, to revision(s) being created.
Each argument must be an existing Phabricator user or group.
+.It Fl t Ar tag
+Add one or more project tags, separated by commas, to revision(s) being created.
+Each argument must be an existing Phabricator project tag.
+Unlike group reviewers, a leading
+.Ql #
+is optional and is added if omitted.
+Spaces in tag names should be replaced with underscores
+.Pq e.g., Src_committers for the Do Src Committers Dc tag .
.It Fl p Ar parent
Specify the parent of the first commit in the list.
This is useful when adding more commits on top of an already existing
@@ -263,6 +272,15 @@ Also, the
.Dq Jails
reviewer group is added using its hashtag.
.Pp
+Create a review and assign project tags so it appears in the
+corresponding Differential queries.
+Spaces in tag names are written as underscores; a leading
+.Ql #
+is optional:
+.Bd -literal -offset indent
+$ git arc create -t linuxkpi,Src_committers HEAD
+.Ed
+.Pp
Create a series of Phabricator reviews for each of HEAD~2, HEAD~ and
HEAD:
.Bd -literal -offset indent
diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index c34d47160749..9a557ad06f1c 100755
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -234,10 +234,40 @@ commit2diff()
echo "$diff"
}
+#
+# Convert a comma-separated tag list into Phabricator project hashtags.
+# Spaces become underscores; a leading '#' is added if missing.
+#
+tags2hashtags()
+{
+ local out rest tag
+
+ out=
+ rest=$1,
+ while [ -n "$rest" ]; do
+ tag=${rest%%,*}
+ rest=${rest#*,}
+ tag=$(printf '%s\n' "$tag" |
+ sed -e 's/^[[:space:]]*//' \
+ -e 's/[[:space:]]*$//' \
+ -e 's/[[:space:]]\{1,\}/_/g')
+ [ -n "$tag" ] || continue
+ case "$tag" in
+ \#*)
+ ;;
+ *)
+ tag="#$tag"
+ ;;
+ esac
+ out="$out, $tag"
+ done
+ printf '%s\n' "${out#, }"
+}
+
create_one_review()
{
local childphid commit doprompt draft msg parent parentphid reviewers
- local subscribers
+ local subscribers tags
commit=$1
reviewers=$2
@@ -245,6 +275,7 @@ create_one_review()
parent=$4
doprompt=$5
draft=$6
+ tags=$7
if [ "$doprompt" ] && ! show_and_prompt "$commit"; then
return 1
@@ -263,6 +294,10 @@ create_one_review()
printf "%s\n" "${reviewers}" >> "$msg"
printf "\nSubscribers:\n" >> "$msg"
printf "%s\n" "${subscribers}" >> "$msg"
+ if [ -n "$tags" ]; then
+ printf "\nTags:\n" >> "$msg"
+ printf "%s\n" "${tags}" >> "$msg"
+ fi
yes | EDITOR=true \
arc diff --message-file "$msg" --never-apply-patches --create \
@@ -377,6 +412,7 @@ build_commit_list()
gitarc__create()
{
local commit commits doprompt draft list o prev reviewers subscribers
+ local tags
list=
prev=""
@@ -385,7 +421,7 @@ gitarc__create()
fi
doprompt=1
draft=0
- while getopts dlp:r:s: o; do
+ while getopts dlp:r:s:t: o; do
case "$o" in
d)
draft=1
@@ -402,6 +438,9 @@ gitarc__create()
s)
subscribers="$OPTARG"
;;
+ t)
+ tags=$(tags2hashtags "$OPTARG")
+ ;;
*)
err_usage
;;
@@ -423,7 +462,7 @@ gitarc__create()
for commit in ${commits}; do
if create_one_review "$commit" "$reviewers" "$subscribers" "$prev" \
- "$doprompt" "$draft"; then
+ "$doprompt" "$draft" "$tags"; then
prev=$(commit2diff "$commit")
else
prev=""