From nobody Mon May 06 17:49:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VY86m4s0Zz5KgRV; Mon, 06 May 2024 17:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VY86m4KMdz4mK8; Mon, 6 May 2024 17:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715017760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S42CHmJ7zEWPmVxedDcY9Ca4eT84mmJbajIC8B7ZOxU=; b=c0jTAFWUR2zVUQNfNqpcm6rKXsUyFOhvqetOYCWuQeuGZgVYJPIOQWqa05mgQYDp+gy868 oirqbKsELEzx3PviKe6dHePFfQwg71LFNwRKwSiQ//DDLqKODTWw8gZIZcsOjgqHzIOV+G g37jlhCSBm8Xa3HelG3WNJNKKySqPBj56KmeDUllRKrCTu7QsMD32IafpAFTaWEaOxjDG8 Uknkt+HtPMPlW3PemxL39F/fks82gpj3jkwTqmTXw/gaoZVsh3mwxo+vLZw4UChdKD/nwK GaE/P1djnvwnncwGowDLpxRfzZOdjGhbfdGnrKJwrdNaFeS2eeuPxIEkh4EPNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715017760; a=rsa-sha256; cv=none; b=TahMJIZvM8UlQ16+/8Hj/PSe1sl+iXuE6wsanKfLMPtCGCgqummZJphBkiWD569+4rnfWR 1u4U2ZJY4jYDtqpdGe08G4yNvNuD+ln4/TuBgf3eEt3zy3teqLT1FO45E8aB2eyBeub2N4 uX4YTrblMXfsyUAnoMvHP0k1pkv2coeCmoCkQ3xQ/ftQuDJk2SfQvErPrYz03/aiqRJV7n pgPt2z59RySQox5yD0vQEefR4pOUU0nkAUwSNffHPRQeCyFuskVVAjMkFgwZQsu1TOLNJA LE90OLomJ/X2yJmfzS8dMpugC7dMpqKbEzbgoKW6ngRUvkLK+US8HCZegwo9zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715017760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S42CHmJ7zEWPmVxedDcY9Ca4eT84mmJbajIC8B7ZOxU=; b=Dc+vxPtPEpvtqXk5Kj8Lt4NDVcpFWW6Yd5/8FMIwY+EXr2m3afUP4cwZs8EyCn0p2QrEMG 9yq6VzEFCB7OqxApOYKfHCbtVq9VKHYtSSm2xK2LJ8LMbIT30NiIhjHiEMU1H07JF5KFuC i2BzHwUHq46zAMP6lZRuR3ZFN7bx37i422BgxHSedCAo52j0QNo9x0vm9NB+WgvXYwiGXa 1/hVdLF7xM81RbiPOhG0Ek1dJ5VSQO6CozkcSC71R/g7OEfwCcbr5yne6S8hj7Ff3G0xYm sTaKSqY4yYAdsz542EOOfAJJPzv3VeooTDwN9OhqAKDZVNM3QJXbVN/hb0UiSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VY86m3wVRz16TF; Mon, 6 May 2024 17:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 446HnKOM075810; Mon, 6 May 2024 17:49:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446HnKXi075807; Mon, 6 May 2024 17:49:20 GMT (envelope-from git) Date: Mon, 6 May 2024 17:49:20 GMT Message-Id: <202405061749.446HnKXi075807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2f68f6474e41 - main - git-arc: Add list mode support for the update command List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f68f6474e4174999bcbab531b9b221c8671f544 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2f68f6474e4174999bcbab531b9b221c8671f544 commit 2f68f6474e4174999bcbab531b9b221c8671f544 Author: John Baldwin AuthorDate: 2024-05-06 17:49:04 +0000 Commit: John Baldwin CommitDate: 2024-05-06 17:49:04 +0000 git-arc: Add list mode support for the update command This can be particularly useful to do bulk-updates of multiple commits using the same message, e.g. git arc update -lm "Move function xyz to libfoo" main..myfeature Similar to the list mode for the create command, git arc will list all the candidate revisions with a single prompt. Once that is confirmed, all the revisions are updated without showing the diffs or pausing further prompts. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45050 --- tools/tools/git/git-arc.1 | 19 ++++++++++++++++--- tools/tools/git/git-arc.sh | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1 index e449875c5043..5ada942d13a9 100644 --- a/tools/tools/git/git-arc.1 +++ b/tools/tools/git/git-arc.1 @@ -50,6 +50,7 @@ .Op Ar commit ... Ns | Ns Ar commit-range .Nm .Cm update +.Op Fl l .Op Fl m Ar message .Op Ar commit ... Ns | Ns Ar commit-range .Sh DESCRIPTION @@ -117,6 +118,11 @@ each revision. If an empty message is supplied via .Fl m , then no notes will be added when updating Differential Revisions. +.Pp +If +.Fl l +is used, display list of commits to be updated and wait for confirmation +of the list rather than prompting for each commit. .El .Sh CONFIGURATION These are manipulated by @@ -138,9 +144,9 @@ Defaults to false. Always use .Dq list mode .Pq Fl l -with create. -In this mode, the list of git revisions to create reviews for -is listed with a single prompt before creating reviews. +with create and update. +In this mode, the list of git revisions to use +is listed with a single prompt before creating or updating reviews. The diffs for individual commits are not shown. Defaults to false. .It Va arc.verbose @@ -227,6 +233,13 @@ List the status of reviews for all the commits in the branch .Bd -literal -offset indent $ git arc list main..feature .Ed +.Pp +Update reviews for all commits in the branch +.Dq feature +after rebasing: +.Bd -literal -offset indent +$ git arc update -lm "Rebase" main..feature +.Ed .Sh SEE ALSO .Xr build 7 , .Xr development 7 diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 1c828f3194af..e8da1f1ed32a 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -53,7 +53,7 @@ Commands: list | patch [-c] [ ...] stage [-b branch] [|] - update [-m message] [|] + update [-l] [-m message] [|] Description: Create or manage FreeBSD Phabricator reviews based on git commits. There @@ -100,11 +100,11 @@ Config Variables: arc.browse [bool] -- Try to open newly created reviews in a browser tab. Defaults to false. - arc.list [bool] -- Always use "list mode" (-l) with create. In this - mode, the list of git revisions to create reviews for - is listed with a single prompt before creating - reviews. The diffs for individual commits are not - shown. + arc.list [bool] -- Always use "list mode" (-l) with create and update. + In this mode, the list of git revisions to use + is listed with a single prompt before creating or + updating reviews. The diffs for individual commits + are not shown. arc.verbose [bool] -- Verbose output. Equivalent to the -v flag. @@ -669,10 +669,18 @@ gitarc__stage() gitarc__update() { - local commit commits diff have_msg msg + local commit commits diff doprompt have_msg list o msg - while getopts m: o; do + list= + if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + list=1 + fi + doprompt=1 + while getopts lm: o; do case "$o" in + l) + list=1 + ;; m) msg="$OPTARG" have_msg=1 @@ -685,10 +693,21 @@ gitarc__update() shift $((OPTIND-1)) commits=$(build_commit_list "$@") + + if [ "$list" ]; then + for commit in ${commits}; do + git --no-pager show --oneline --no-patch "$commit" + done | git_pager + if ! prompt; then + return + fi + doprompt= + fi + for commit in ${commits}; do diff=$(commit2diff "$commit") - if ! show_and_prompt "$commit"; then + if [ "$doprompt" ] && ! show_and_prompt "$commit"; then break fi