]> git.ozlabs.org Git - next-scripts/commitdiff
implement switch to put some merges in sub branches
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 29 May 2024 04:52:21 +0000 (14:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 29 May 2024 04:52:21 +0000 (14:52 +1000)
common.sh
do_merge
from_build_host
make_tree_file
push-pending-fixes

index 7406e784bbe786f38ffd57ed062fa786cd187cca..0bb8d69f5e7c0b4f364dc77718e200d5478f5ebd 100644 (file)
--- a/common.sh
+++ b/common.sh
@@ -77,17 +77,17 @@ _TAB=$(printf '\t')
 
 get_control_field()
 {
-       awk -F "$_TAB" -v branch="$1" -v field="$2" '/^[^#]/ && $3==branch { print $field; }' "$CTRL_FILE"
+       awk -F "$_TAB" -v branch="$1" -v field="$2" '/^[^-#]/ && $3==branch { print $field; }' "$CTRL_FILE"
 }
 
 get_branches()
 {
-       awk -F "$_TAB" '/^[^#]/ && $2=="git"{ print $3; }' "$CTRL_FILE"
+       awk -F "$_TAB" '/^[^-#]/ && $2=="git"{ print $3; }' "$CTRL_FILE"
 }
 
 get_pending_branches()
 {
-       awk -F "$_TAB" '/^[^#]/ && $2=="git"{ print $3; } $1=="pending-fixes" { exit; }' "$CTRL_FILE"
+       awk -F "$_TAB" '/^[^-#]/ && $2=="git"{ print $3; } $1=="pending-fixes" { exit; }' "$CTRL_FILE"
 }
 
 get_contacts()
index cecd32708ecf72fcf49d5fc5ac21f5168c1af333..9f46350f363cb4f1365c5f89646ab64e395d8b7d 100755 (executable)
--- a/do_merge
+++ b/do_merge
@@ -72,12 +72,14 @@ fi
 heads=$(awk -F '\t' '
        /^#/ { next; }
        $2=="git" { printf("%s/%s ", $3, $5); }
-       $2=="branch" { printf("branch/%s ", $1); }' "$CTRL_FILE")
+       $2=="branch" { printf("branch/%s ", $1); }
+       $2=="switch" { printf("switch/%s/%s ", $3, $4); }' "$CTRL_FILE")
 
 need_build=false
 
 for h in $heads; do
        tree=${h%%/*}
+       branch=${h#"$tree"/}
 
        if [ -n "$start_from" ]; then
                if [ "$tree" = "$start_from" ]; then
@@ -88,11 +90,34 @@ for h in $heads; do
        fi
 
        if [ "$tree" = "branch" ]; then
-               git branch -f "${h#branch/}"
-               linux-next-notify "update branch ${h#branch/}"
+               git branch -f "$branch"
+               linux-next-notify "update branch $branch"
                continue
        fi
 
+       if [ "$tree" = 'switch' ]; then
+               new_branch=${branch%%/*}
+               if [ "$new_branch" = 'master' ]; then
+                       old_branch=$(git branch --show-current)
+                       if ! [ "$old_branch" = 'master' ]; then
+                               if ! cd ../next; then
+                                       fix_up 'no ../next directory!'
+                               fi
+                               git worktree remove "$old_branch"
+                       fi
+               else
+                       base=${branch#"$new_branch"/}
+                       if ! git worktree add -B "$new_branch" ../"$new_branch" "$base"; then
+                               fix_up 'git worktree add failed'
+                       fi
+                       if ! cd ../"$new_branch"; then
+                               fix_up 'cannot chdir to new worktree directory'
+                       fi
+               fi
+               continue
+       fi
+
+       h=${h%/}
        hlog=$(git log -1 --oneline "$h") 2>/dev/null
        old_head=$(git rev-parse HEAD)
        if [ -f "../pre-merge/$tree" ]; then
@@ -160,7 +185,7 @@ for h in $heads; do
        fi
 
        repo="${build_host:+$build_host:}${build_dir}"
-       if ! git push -f "$repo" master:refs/heads/next; then
+       if ! git push -f "$repo" HEAD:refs/heads/next; then
                fix_up "push failed for $tree" "git push failed"
        fi
 
index 50cabe8af707710fb017f7e05daf8d630c22eb1d..42b94c8422336cad80c6902f5678c619262d7e7f 100755 (executable)
@@ -6,6 +6,8 @@ rsync -avHPSUXx --open-noatime --delete \
        --exclude "gitk.cache" \
        --exclude '.gitk-tmp**' \
        --include '/duplicates/***' \
+       --include '/fs-common/***' \
+       --include '/fs-next/***' \
        --include '/patches/***' \
        --include '/next/***' \
        --include /SHA1s \
index 1e2a9da0b05c3fdf72929f71693197a92af91762..eb88b7ecf83779ccd773da07b9c3f35eadbe477c 100755 (executable)
@@ -35,7 +35,7 @@ mkdir Next
                fi
                type=$(get_type "$name")
                url=$(get_url "$name")
-               if [ "$type" = "git" ]; then
+               if [ "$type" = "git" ] && ! [ "$url" = 'linux-next' ]; then
                        ref=$(get_remote_branch "$name")
                        url="$url#$ref"
                fi
index 9ed5ab93cccc7b8d7228e64d10329392814113a3..b6f837e34b57165a578284097c68c3c9b47edeef 100755 (executable)
@@ -4,7 +4,7 @@ read -r -p "Yubikey token: " tok
 # shellcheck disable=SC2029
 ssh git@gitolite.kernel.org 2fa val-session "$tok"
 
-git push -f korg refs/heads/pending-fixes:refs/heads/pending-fixes
+git push -f korg refs/heads/pending-fixes:refs/heads/pending-fixes refs/heads/fs-current:refs/heads/fs-current
 
 ssh -O exit git@gitolite.kernel.org