From nobody Thu Dec 4 19:48:26 2025 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 4dMlRv0F3Rz6JcbG for ; Thu, 04 Dec 2025 19:48:27 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dMlRt5Fvnz3sBY for ; Thu, 04 Dec 2025 19:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764877706; 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=E2nqQsD8EbMRO0yFdmoWxYcU52YYmimrsEt0VpQx3Ks=; b=xbaw5eA/2SZp28CfECiMdrpLWE2VxzuXNC5ZPWJY+33zQlFHln5HT2JLlN7jDMi8kbhEL7 c1KWbub8UlZU3bFQNTeBTNGtiS598k/pGyQY0qW9vVsXuRwRpTO410hSuAxNhDnVaUg0L2 i4CZIbReMAI1Xg6tMK9lMLgG4xQHdcQX7Hf/vAvlVEb5QFbKEa3NGhzJZomagCiZra632u ff1QUy2mhXLagjUiY+Vt/48wgdkhlEVtscc7uAc4HYUgWHtaTN5CWiRAzcPjMgatq7WfZs IFNxK3i+2SjAcmK56OJJMLbAxnehEvKGbkgV02OEM2oStoY3rclVPJvR+SBnBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764877706; 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=E2nqQsD8EbMRO0yFdmoWxYcU52YYmimrsEt0VpQx3Ks=; b=RjtfND0u2CgPUMQn25czrPiJViuQoIVR4h8scN1sLhKBSMFEvQUgOkYd19h3NjnzS9nAzq P1kn4CqEkLWQYFc0VR33DtNt2RrNn4OS83kd06tOTRhswvuUMioGvrvplMJpFABm8ZXxSp VdB8o1Do4qd5HbEyvoqZgxg7Y+aN5HuWyS4D53wbOJlzi0B67R+7OtPITEg5OgZqyu+DgM IhaTQjTJmewC//pQj1JCzNDkQmJOTerDZRhu5jEiKtX0wRowy08sbt+Splb/wVvN8/wf5J +P4+cLbyxUP6BOk7t4R+opcIxTvc/f+b/0+cWBVn0XIjxFk9QPl3QjTdeyNArg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764877706; a=rsa-sha256; cv=none; b=dNKnXPC87ALqXAJ1mwLpNzfPKkk3O/5BWAAdLy3Ho+GRX2q4WxXyqbP3HpQuXhwl0xsCGz Mq5gACWwd1qd4pZXiTkDmSG3L4cm2tBn26u6/O0ws5JgH9EWhsGLwDNFIgkJ0QS9ll15Fj Yb252wxuG14z5Kp65Zgy13X7yeYr//E5dqWWX6UPpCgYaKnTln7uzG/z9jt76QvMntlAvk tyuicveLwwEXUQ1yFIUROk7HwgUsPbRZL4hApg86mPjxpfid0PEI5NnDl/fD+mlnsezsQw 3+zT9JQUJ52KkWpfDhq19DFycic+W+D/y7HAKigWtWeFmIdQX3NG6+FqFA7HJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dMlRt3qx1zf87 for ; Thu, 04 Dec 2025 19:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 250e0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 04 Dec 2025 19:48:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Mingrone Subject: git: 97939604f447 - main - git-arc: Add patch -b option 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: jrm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97939604f447de0d06e6cc2c15f19c6f7be30cd2 Auto-Submitted: auto-generated Date: Thu, 04 Dec 2025 19:48:26 +0000 Message-Id: <6931e58a.250e0.20996fbb@gitrepo.freebsd.org> The branch main has been updated by jrm: URL: https://cgit.FreeBSD.org/src/commit/?id=97939604f447de0d06e6cc2c15f19c6f7be30cd2 commit 97939604f447de0d06e6cc2c15f19c6f7be30cd2 Author: Joseph Mingrone AuthorDate: 2025-12-01 23:23:37 +0000 Commit: Joseph Mingrone CommitDate: 2025-12-04 19:45:05 +0000 git-arc: Add patch -b option With the new patch -b option, switch to a new branch before applying changes from Differential revisions. While here, do some minor clean-up: - Fix a check to determine whether `arc patch` ran successfully. - Always ensure at least one argument is supplied to `git arc patch`. Sponsored by: The FreeBSD Foundation Reviewed by: imp, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54024 --- tools/tools/git/git-arc.sh | 58 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 8507d96fda63..98d29809d636 100755 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -59,7 +59,7 @@ Usage: git arc [-vy] Commands: create [-l] [-r [,...]] [-s subscriber[,...]] [|] list | - patch [-c] [ ...] + patch [-bc] [ ...] stage [-b branch] [|] update [-l] [-m message] [|] @@ -75,8 +75,10 @@ Description: create -- Create new Differential revisions from the specified commits. list -- Print the associated Differential revisions for the specified commits. - patch -- Try to apply a patch from a Differential revision to the - currently checked out tree. + patch -- Apply patches from Differential revisions. By default, patches + are applied to the currently checked-out tree, unless -b is + supplied, in which case a new branch is first created. The -c + option commits the applied patch using the review's metadata. stage -- Prepare a series of commits to be pushed to the upstream FreeBSD repository. The commits are cherry-picked to a branch (main by default), review tags are added to the commit log message, and @@ -146,6 +148,11 @@ Examples: $ git arc patch -c D12345 + Apply the patches in reviews D12345 and D12346 in a new branch, and commit + them using the review titles, summaries and authors. + + $ git arc patch -bc D12345 D12346 + List the status of reviews for all the commits in the branch "feature": $ git arc list main..feature @@ -567,6 +574,26 @@ find_author() echo "${a}" } +patch_branch() +{ + local base new suffix + + if [ $# -eq 1 ]; then + base="gitarc-$1" + else + base="gitarc-$(printf "%s-" "$@" | sed 's/-$//')" + fi + + new="$base" + suffix=1 + while git show-ref --quiet --branches "$new"; do + new="${base}_$suffix" + suffix=$((suffix + 1)) + done + + git checkout -b "$new" +} + patch_commit() { local diff reviewid review_data authorid user_data user_addr user_name @@ -626,15 +653,16 @@ patch_commit() gitarc__patch() { - local rev commit - - if [ $# -eq 0 ]; then - err_usage - fi + local branch commit rev + branch=false commit=false - while getopts c o; do + while getopts bc o; do case "$o" in + b) + require_clean_work_tree "patch -b" + branch=true + ;; c) require_clean_work_tree "patch -c" commit=true @@ -646,10 +674,18 @@ gitarc__patch() done shift $((OPTIND-1)) + if [ $# -eq 0 ]; then + err_usage + fi + + if ${branch}; then + patch_branch "$@" + fi for rev in "$@"; do - arc patch --skip-dependencies --nocommit --nobranch --force "$rev" + if ! arc patch --skip-dependencies --nobranch --nocommit --force "$rev"; then + break + fi echo "Applying ${rev}..." - [ $? -eq 0 ] || break if ${commit}; then patch_commit $rev fi