Update git scripts to use git-list-tor-branches.sh

This commit is contained in:
Nick Mathewson 2020-02-11 12:17:03 -05:00 committed by David Goulet
parent 42660ea056
commit d9152b8a66
4 changed files with 28 additions and 205 deletions

View File

@ -91,41 +91,11 @@ TOR_WKT_NAME=${TOR_WKT_NAME:-"tor-wkt"}
# But it's the earliest maint branch, so we don't merge forward into it. # But it's the earliest maint branch, so we don't merge forward into it.
# Since we don't merge forward into it, the second and fifth items must be # Since we don't merge forward into it, the second and fifth items must be
# blank (""). # blank ("").
MAINT_035_TB=( "maint-0.3.5" "" "$GIT_PATH/$TOR_WKT_NAME/maint-0.3.5" \
"_035" "")
# Used in maint/release merge and test branch modes
MAINT_041=( "maint-0.4.1" "maint-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.1" \
"_041" "_035")
MAINT_042=( "maint-0.4.2" "maint-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.2" \
"_042" "_041")
MAINT_043=( "maint-0.4.3" "maint-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.3" \
"_043" "_042")
MAINT_MASTER=( "master" "maint-0.4.3" "$GIT_PATH/$TOR_MASTER_NAME" \
"_master" "_043")
RELEASE_035=( "release-0.3.5" "maint-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/release-0.3.5" )
RELEASE_041=( "release-0.4.1" "maint-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.1" )
RELEASE_042=( "release-0.4.2" "maint-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.2" )
RELEASE_043=( "release-0.4.3" "maint-0.4.3" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.3" )
# The master branch path has to be the main repository thus contains the
# origin that will be used to fetch the updates. All the worktrees are created # origin that will be used to fetch the updates. All the worktrees are created
# from that repository. # from that repository.
ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME" ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME"
# SC2034 -- shellcheck thinks that these are unused. We know better.
ACTUALLY_THESE_ARE_USED=<<EOF
${MAINT_035_TB[0]}
${MAINT_041[0]}
${MAINT_042[0]}
${MAINT_043[0]}
${MAINT_MASTER[0]}
${RELEASE_035[0]}
${RELEASE_041[0]}
${RELEASE_042[0]}
${RELEASE_043[0]}
EOF
####################### #######################
# Argument processing # # Argument processing #
####################### #######################
@ -170,49 +140,16 @@ done
# Git worktrees to manage # # Git worktrees to manage #
########################### ###########################
set -e
if [ -z "$TEST_BRANCH_PREFIX" ]; then if [ -z "$TEST_BRANCH_PREFIX" ]; then
# maint/release merge mode # maint/release merge mode
# eval "$(git-list-tor-branches.sh -m)"
# List of all worktrees to merge forward into. All defined above. # Remove first element: we don't merge forward into it.
# Ordering is important. Always the maint-* branch BEFORE the release-*. WORKTREE=( "${WORKTREE[@]:1}" )
WORKTREE=(
# We don't merge forward into MAINT_035_TB[@], because it's the earliest
# maint branch
RELEASE_035[@]
MAINT_041[@]
RELEASE_041[@]
MAINT_042[@]
RELEASE_042[@]
MAINT_043[@]
RELEASE_043[@]
MAINT_MASTER[@]
)
else else
eval "$(git-list-tor-branches.sh -m -R)"
# Test branch mode: base test branches on maint branches only
#
# List of all worktrees to create test branches from. All defined above.
# Ordering is important. All maint-* branches, including the earliest one.
WORKTREE=(
# We want a test branch based on the earliest maint branch
MAINT_035_TB[@]
MAINT_041[@]
MAINT_042[@]
MAINT_043[@]
MAINT_MASTER[@]
)
fi fi
set +e
COUNT=${#WORKTREE[@]} COUNT=${#WORKTREE[@]}

View File

@ -2,7 +2,7 @@
SCRIPT_NAME=$(basename "$0") SCRIPT_NAME=$(basename "$0")
function usage() usage()
{ {
echo "$SCRIPT_NAME [-h] [-n]" echo "$SCRIPT_NAME [-h] [-n]"
echo echo
@ -47,66 +47,15 @@ TOR_WKT_NAME=${TOR_WKT_NAME:-"tor-wkt"}
# Git branches to manage # # Git branches to manage #
########################## ##########################
# Configuration of the branches that need pulling. The values are in order: set -e
# (1) Branch name to pull (update). eval "$(git-list-tor-branches.sh -b)"
# (2) Full path of the git worktree. set +e
#
# As an example:
# $ cd <PATH/TO/WORKTREE> (3)
# $ git checkout maint-0.3.5 (1)
# $ git pull
#
# First set of arrays are the maint-* branch and then the release-* branch.
# New arrays need to be in the WORKTREE= array else they aren't considered.
MAINT_035=( "maint-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/maint-0.3.5" )
MAINT_041=( "maint-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.1" )
MAINT_042=( "maint-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.2" )
MAINT_043=( "maint-0.4.3" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.3" )
MAINT_MASTER=( "master" "$GIT_PATH/$TOR_MASTER_NAME" )
RELEASE_035=( "release-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/release-0.3.5" )
RELEASE_041=( "release-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.1" )
RELEASE_042=( "release-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.2" )
RELEASE_043=( "release-0.4.3" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.3" )
# The master branch path has to be the main repository thus contains the # The master branch path has to be the main repository thus contains the
# origin that will be used to fetch the updates. All the worktrees are created # origin that will be used to fetch the updates. All the worktrees are created
# from that repository. # from that repository.
ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME" ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME"
# SC2034 -- shellcheck thinks that these are unused. We know better.
ACTUALLY_THESE_ARE_USED=<<EOF
${MAINT_035[0]}
${MAINT_041[0]}
${MAINT_042[0]}
${MAINT_043[0]}
${MAINT_MASTER[0]}
${RELEASE_035[0]}
${RELEASE_041[0]}
${RELEASE_042[0]}
${RELEASE_043[0]}
EOF
###########################
# Git worktrees to manage #
###########################
# List of all worktrees to pull. All defined above. Ordering is not important.
WORKTREE=(
MAINT_035[@]
RELEASE_035[@]
MAINT_041[@]
RELEASE_041[@]
MAINT_042[@]
RELEASE_042[@]
MAINT_043[@]
RELEASE_043[@]
MAINT_MASTER[@]
)
COUNT=${#WORKTREE[@]} COUNT=${#WORKTREE[@]}
####################### #######################

View File

@ -168,63 +168,42 @@ echo "Calling $GIT_PUSH" "$@" "<branches>"
# Git upstream remote branches # # Git upstream remote branches #
################################ ################################
set -e
DEFAULT_UPSTREAM_BRANCHES= DEFAULT_UPSTREAM_BRANCHES=
if [ "$DEFAULT_UPSTREAM_REMOTE" != "$UPSTREAM_REMOTE" ]; then if [ "$DEFAULT_UPSTREAM_REMOTE" != "$UPSTREAM_REMOTE" ]; then
DEFAULT_UPSTREAM_BRANCHES=$(echo \ for br in $(git-list-tor-branches.sh -l); do
"$DEFAULT_UPSTREAM_REMOTE"/master \ DEFAULT_UPSTREAM_BRANCHES="${DEFAULT_UPSTREAM_BRANCHES} ${DEFAULT_UPSTREAM_REMOTE}/${br}"
"$DEFAULT_UPSTREAM_REMOTE"/{release,maint}-0.4.3 \ done
"$DEFAULT_UPSTREAM_REMOTE"/{release,maint}-0.4.2 \
"$DEFAULT_UPSTREAM_REMOTE"/{release,maint}-0.4.1 \
"$DEFAULT_UPSTREAM_REMOTE"/{release,maint}-0.3.5 \
)
fi fi
UPSTREAM_BRANCHES=$(echo \ UPSTREAM_BRANCHES=
"$UPSTREAM_REMOTE"/master \ for br in $(git-list-tor-branches.sh -l); do
"$UPSTREAM_REMOTE"/{release,maint}-0.4.3 \ UPSTREAM_BRANCHES="${UPSTREAM_BRANCHES} ${UPSTREAM_REMOTE}/${br}"
"$UPSTREAM_REMOTE"/{release,maint}-0.4.2 \ done
"$UPSTREAM_REMOTE"/{release,maint}-0.4.1 \
"$UPSTREAM_REMOTE"/{release,maint}-0.3.5 \
)
######################## ########################
# Git branches to push # # Git branches to push #
######################## ########################
PUSH_BRANCHES=$(echo \
master \
{release,maint}-0.4.3 \
{release,maint}-0.4.2 \
{release,maint}-0.4.1 \
{release,maint}-0.3.5 \
)
if [ -z "$TEST_BRANCH_PREFIX" ]; then if [ -z "$TEST_BRANCH_PREFIX" ]; then
# maint/release push mode: push all branches. # maint/release push mode: push all branches.
# #
# List of branches to push. Ordering is not important. # List of branches to push. Ordering is not important.
PUSH_BRANCHES=$(echo \ PUSH_BRANCHES="$(git-list-tor-branches.sh -l)"
master \
{release,maint}-0.4.3 \
{release,maint}-0.4.2 \
{release,maint}-0.4.1 \
{release,maint}-0.3.5 \
)
else else
# Test branch push mode: push test branches, based on each maint branch. # Test branch push mode: push test branches, based on each maint branch.
# #
# List of branches to push. Ordering is not important. # List of branches to push. Ordering is not important.
PUSH_BRANCHES=" \ PUSH_BRANCHES=""
${TEST_BRANCH_PREFIX}_master \ for suffix in $(git-list-tor-branches.sh -s -R); do
${TEST_BRANCH_PREFIX}_043 \ PUSH_BRANCHES="${PUSH_BRANCHES} ${TEST_BRANCH_PREFIX}${suffix}"
${TEST_BRANCH_PREFIX}_042 \ done
${TEST_BRANCH_PREFIX}_041 \
${TEST_BRANCH_PREFIX}_035 \
"
fi fi
set +e
############### ###############
# Entry point # # Entry point #
############### ###############

View File

@ -90,41 +90,15 @@ GITHUB_PUSH=${TOR_GITHUB_PUSH:-"No_Pushing_To_GitHub"}
# The branches and worktrees need to be modified when there is a new branch, # The branches and worktrees need to be modified when there is a new branch,
# and when an old branch is no longer supported. # and when an old branch is no longer supported.
# Configuration of the branches that needs merging. The values are in order: set -e
# (0) current maint/release branch name eval "$(git-list-tor-branches.sh -b)"
# (1) Full path of the git worktree set +e
#
# First set of arrays are the maint-* branch and then the release-* branch.
# New arrays need to be in the WORKTREE= array else they aren't considered.
MAINT_035=( "maint-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/maint-0.3.5" )
MAINT_041=( "maint-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.1" )
MAINT_042=( "maint-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.2" )
MAINT_043=( "maint-0.4.3" "$GIT_PATH/$TOR_WKT_NAME/maint-0.4.3" )
MAINT_MASTER=( "master" "$GIT_PATH/$TOR_MASTER_NAME" )
RELEASE_035=( "release-0.3.5" "$GIT_PATH/$TOR_WKT_NAME/release-0.3.5" )
RELEASE_041=( "release-0.4.1" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.1" )
RELEASE_042=( "release-0.4.2" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.2" )
RELEASE_043=( "release-0.4.3" "$GIT_PATH/$TOR_WKT_NAME/release-0.4.3" )
# The master branch path has to be the main repository thus contains the # The master branch path has to be the main repository thus contains the
# origin that will be used to fetch the updates. All the worktrees are created # origin that will be used to fetch the updates. All the worktrees are created
# from that repository. # from that repository.
ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME" ORIGIN_PATH="$GIT_PATH/$TOR_MASTER_NAME"
# SC2034 -- shellcheck thinks that these are unused. We know better.
ACTUALLY_THESE_ARE_USED=<<EOF
${MAINT_035[0]}
${MAINT_041[0]}
${MAINT_042[0]}
${MAINT_043[0]}
${MAINT_MASTER[0]}
${RELEASE_035[0]}
${RELEASE_041[0]}
${RELEASE_042[0]}
${RELEASE_043[0]}
EOF
####################### #######################
# Argument processing # # Argument processing #
####################### #######################
@ -161,22 +135,6 @@ done
# Git worktrees to manage # # Git worktrees to manage #
########################### ###########################
WORKTREE=(
MAINT_035[@]
RELEASE_035[@]
MAINT_041[@]
RELEASE_041[@]
MAINT_042[@]
RELEASE_042[@]
MAINT_043[@]
RELEASE_043[@]
MAINT_MASTER[@]
)
COUNT=${#WORKTREE[@]} COUNT=${#WORKTREE[@]}
############# #############