diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-04-28 14:02:58 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-04-28 14:02:58 +0000 |
| commit | 448ec129bcef6bf147b76956ec588e357a21d310 (patch) | |
| tree | 987092078742f666ab98dc57bc766d596e825cef | |
| parent | 0f91468c040eb2129618e5ac251afc2529edb462 (diff) | |
git-arc: Add a create-draft mode
Make it possible to create a review without publishing it. This should
be useful when one wants to restrict the visibility of a review, as that
cannot be done via the command line. Note that a draft review is still
publicly visible if one can guess the URL, but creating one does not
result in email notifications to subscribers etc., nor does a draft
appear in the creating user's activity log.
Once a draft is ready, one can publish it via the web UI.
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D56664
| -rw-r--r-- | tools/tools/git/git-arc.1 | 10 | ||||
| -rwxr-xr-x | tools/tools/git/git-arc.sh | 21 |
2 files changed, 24 insertions, 7 deletions
diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1 index 6dfec53a84ad..da5732fdba26 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 February 10, 2026 +.Dd April 27, 2026 .Dt GIT-ARC 1 .Os .Sh NAME @@ -33,7 +33,7 @@ .Sh SYNOPSIS .Nm .Cm create -.Op Fl l +.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 p Ar parent @@ -95,6 +95,12 @@ The available verbs are: Create new Differential Revisions from the specified commits. Accepts options: .Bl -tag -width "-s subscriber" +.It Fl d +Create the diff as a draft. +In this mode, notifications are not sent to reviewers and subscribers +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 l Before processing commit(s) display list of commits to be processed and wait for confirmation. diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 23b855aef8af..395787df970c 100755 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -234,7 +234,7 @@ commit2diff() create_one_review() { - local childphid commit doprompt msg parent parentphid reviewers + local childphid commit doprompt draft msg parent parentphid reviewers local subscribers commit=$1 @@ -242,11 +242,18 @@ create_one_review() subscribers=$3 parent=$4 doprompt=$5 + draft=$6 if [ "$doprompt" ] && ! show_and_prompt "$commit"; then return 1 fi + if [ "$draft" -eq 1 ]; then + draft=--draft + else + unset draft + fi + msg=$(xmktemp) git show -s --format='%B' "$commit" > "$msg" printf "\nTest Plan:\n" >> "$msg" @@ -257,7 +264,7 @@ create_one_review() yes | EDITOR=true \ arc diff --message-file "$msg" --never-apply-patches --create \ - --allow-untracked $BROWSE --head "$commit" "${commit}~" + --allow-untracked $draft $BROWSE --head "$commit" "${commit}~" [ $? -eq 0 ] || err "could not create Phabricator diff" if [ -n "$parent" ]; then @@ -351,7 +358,7 @@ build_commit_list() gitarc__create() { - local commit commits doprompt list o prev reviewers subscribers + local commit commits doprompt draft list o prev reviewers subscribers list= prev="" @@ -359,8 +366,12 @@ gitarc__create() list=1 fi doprompt=1 - while getopts lp:r:s: o; do + draft=0 + while getopts dlp:r:s: o; do case "$o" in + d) + draft=1 + ;; l) list=1 ;; @@ -394,7 +405,7 @@ gitarc__create() for commit in ${commits}; do if create_one_review "$commit" "$reviewers" "$subscribers" "$prev" \ - "$doprompt"; then + "$doprompt" "$draft"; then prev=$(commit2diff "$commit") else prev="" |
