From: Stephen Rothwell Date: Wed, 29 May 2024 04:52:21 +0000 (+1000) Subject: implement switch to put some merges in sub branches X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=f4cbeeb0c03dba8fd230b28d5b9a44482acd65c8;p=next-scripts implement switch to put some merges in sub branches --- diff --git a/common.sh b/common.sh index 7406e78..0bb8d69 100644 --- 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() diff --git a/do_merge b/do_merge index cecd327..9f46350 100755 --- 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 diff --git a/from_build_host b/from_build_host index 50cabe8..42b94c8 100755 --- a/from_build_host +++ b/from_build_host @@ -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 \ diff --git a/make_tree_file b/make_tree_file index 1e2a9da..eb88b7e 100755 --- a/make_tree_file +++ b/make_tree_file @@ -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 diff --git a/push-pending-fixes b/push-pending-fixes index 9ed5ab9..b6f837e 100755 --- a/push-pending-fixes +++ b/push-pending-fixes @@ -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