Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167849394
D59019.vs184413.id184578.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D59019.vs184413.id184578.diff
View Options
diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1
--- 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 19, 2026
.Dt GIT-ARC 1
.Os
.Sh NAME
@@ -33,9 +33,10 @@
.Sh SYNOPSIS
.Nm
.Cm create
-.Op Fl dl
+.Op Fl dhl
.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
@@ -103,6 +104,8 @@
until the review is published via the web UI.
The draft is still visible to anyone with the URL (or able to guess it),
but the review's visibility settings can be modified before publishing.
+.It Fl h
+Print usage statement and exit.
.It Fl l
Before processing commit(s) display list of commits to be processed
and wait for confirmation.
@@ -114,6 +117,14 @@
.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 +274,15 @@
.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
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -55,15 +55,16 @@
err_usage()
{
cat >&2 <<__EOF__
-Usage: git arc [-vy] <command> <arguments>
+Usage: git arc [-hvy] <command> <arguments>
Commands:
- create [-dl] [-r <reviewer1>[,<reviewer2>...]] [-s subscriber[,...]] [<commit>|<commit range>]
+ create [-dhl] [-r <reviewer1>[,<reviewer2>...]] [-s subscriber[,...]] \\
+ [-t tag[,...]] <commit>|<commit range>
diff <commit>|<commit range>
list <commit>|<commit range>
patch [-bcrs] <diff1> [<diff2> ...]
- stage [-b branch] [<commit>|<commit range>]
- update [-l] [-m message] [<commit>|<commit range>]
+ stage [-b branch] <commit>|<commit range>
+ update [-l] [-m message] <commit>|<commit range>
See git-arc(1) for details.
__EOF__
@@ -92,9 +93,9 @@
# the devel/arcanist-port, which installs a symlink in ${LOCALBASE}/bin
# but conflicts with the archivers/arc port.
#
-: ${LOCALBASE:=$(sysctl -n user.localbase)}
-: ${LOCALBASE:=/usr/local}
-: ${ARC_CMD:=${LOCALBASE}/lib/php/arcanist/bin/arc}
+: "${LOCALBASE:=$(sysctl -n user.localbase)}"
+: "${LOCALBASE:=/usr/local}"
+: "${ARC_CMD:=${LOCALBASE}/lib/php/arcanist/bin/arc}"
arc()
{
${ARC_CMD} "$@"
@@ -234,10 +235,40 @@
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 +276,7 @@
parent=$4
doprompt=$5
draft=$6
+ tags=$7
if [ "$doprompt" ] && ! show_and_prompt "$commit"; then
return 1
@@ -263,6 +295,10 @@
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 +413,7 @@
gitarc__create()
{
local commit commits doprompt draft list o prev reviewers subscribers
+ local tags
list=
prev=""
@@ -385,11 +422,14 @@
fi
doprompt=1
draft=0
- while getopts dlp:r:s: o; do
+ while getopts dhlp:r:s:t: o; do
case "$o" in
d)
draft=1
;;
+ h)
+ err_usage
+ ;;
l)
list=1
;;
@@ -402,6 +442,9 @@
s)
subscribers="$OPTARG"
;;
+ t)
+ tags=$(tags2hashtags "$OPTARG")
+ ;;
*)
err_usage
;;
@@ -423,7 +466,7 @@
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=""
@@ -698,7 +741,7 @@
commit=false
raw=false
stack=false
- while getopts bcrs o; do
+ while getopts bchrs o; do
case "$o" in
b)
require_clean_work_tree "patch -b"
@@ -708,6 +751,9 @@
require_clean_work_tree "patch -c"
commit=true
;;
+ h)
+ err_usage
+ ;;
r)
raw=true
;;
@@ -722,6 +768,7 @@
shift $((OPTIND-1))
if [ $# -eq 0 ]; then
+ warn "Too few arguments"
err_usage
fi
@@ -739,11 +786,14 @@
local author branch commit commits diff reviewers title tmp
branch=main
- while getopts b: o; do
+ while getopts b:h o; do
case "$o" in
b)
branch="$OPTARG"
;;
+ h)
+ err_usage
+ ;;
*)
err_usage
;;
@@ -791,8 +841,11 @@
list=1
fi
doprompt=1
- while getopts lm: o; do
+ while getopts hlm: o; do
case "$o" in
+ h)
+ err_usage
+ ;;
l)
list=1
;;
@@ -847,8 +900,11 @@
fi
VERBOSE=
-while getopts vy o; do
+while getopts hvy o; do
case "$o" in
+ h)
+ err_usage
+ ;;
v)
VERBOSE=1
;;
@@ -862,15 +918,9 @@
done
shift $((OPTIND-1))
-[ $# -ge 1 ] || err_usage
-
-[ -x "${ARC_CMD}" ] || err "arc is required, install devel/arcanist-lib"
-which jq >/dev/null 2>&1 || err "jq is required, install textproc/jq"
-
-if [ "$VERBOSE" ]; then
- exec 3>&1
-else
- exec 3> /dev/null
+if [ $# -eq 0 ]; then
+ warn "Too few arguments"
+ err_usage
fi
case "$1" in
@@ -883,11 +933,36 @@
verb=$1
shift
+#
+# git-sh-setup, sourced below, treats leading -h as help, exits with $USAGE.
+# Handle -h first so "git arc create -h", for example, prints usage statement.
+#
+for arg in "$@"; do
+ case "$arg" in
+ -h)
+ err_usage
+ ;;
+ --)
+ break
+ ;;
+ esac
+done
+
# All subcommands require at least one parameter.
if [ $# -eq 0 ]; then
+ warn "Too few arguments"
err_usage
fi
+[ -x "${ARC_CMD}" ] || err "arc is required, install devel/arcanist-lib"
+which jq >/dev/null 2>&1 || err "jq is required, install textproc/jq"
+
+if [ "$VERBOSE" ]; then
+ exec 3>&1
+else
+ exec 3> /dev/null
+fi
+
# Pull in some git helper functions.
git_sh_setup=$(git --exec-path)/git-sh-setup
[ -f "$git_sh_setup" ] || err "cannot find git-sh-setup"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 12:02 AM (14 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37223032
Default Alt Text
D59019.vs184413.id184578.diff (8 KB)
Attached To
Mode
D59019: git-arc: -t tag support for create to set Phabricator project tags
Attached
Detach File
Event Timeline
Log In to Comment