Page MenuHomeFreeBSD

D54024.1775818887.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D54024.1775818887.diff

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
@@ -59,7 +59,7 @@
Commands:
create [-l] [-r <reviewer1>[,<reviewer2>...]] [-s subscriber[,...]] [<commit>|<commit range>]
list <commit>|<commit range>
- patch [-c] <diff1> [<diff2> ...]
+ patch [-bc] <diff1> [<diff2> ...]
stage [-b branch] [<commit>|<commit range>]
update [-l] [-m message] [<commit>|<commit range>]
@@ -75,8 +75,10 @@
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 @@
$ 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 @@
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 @@
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 @@
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

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 10, 11:01 AM (10 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28315787
Default Alt Text
D54024.1775818887.diff (3 KB)

Event Timeline