Skip to content

Sync script: handle multi commit merges #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fetch_remote() {

new_candidate_branch() {
echo "Creating a sync branch if it doesn't already exist"
git checkout -b "$SYNC_BRANCH_NAME" upstream/master 2>/dev/null || git checkout "$SYNC_BRANCH_NAME"
git checkout -b "$SYNC_BRANCH_NAME" master 2>/dev/null || git checkout "$SYNC_BRANCH_NAME"
}

candidates() {
Expand All @@ -50,13 +50,13 @@ pop() {
}

check_local_branch_commit_diff() {
commits_ahead=$(git rev-list upstream/master..HEAD | wc -l)
commits_ahead=$(git rev-list master..HEAD | wc -l)

if [[ "$commits_ahead" -gt 1 ]]; then
# TODO: automatically open a new pull request here.
echo "The local sync branch is $commits_ahead commits ahead of the upstream/master branch"
echo "The local sync branch is $commits_ahead commits ahead of the master branch"
else
echo "No sync PR is needed as the upstream/master branch is up-to-date"
echo "No sync PR is needed as the master branch is up-to-date"
fi
}

Expand Down
3 changes: 2 additions & 1 deletion scripts/sync_get_candidates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ cherrypick_set="${remote}.cherrypick"
: > "${cherrypick_set}" # clear existing file
for rc in "${remote_commits[@]}"; do
if [[ -z $(git log -n 1 --no-merges --grep "${rc}" HEAD) && -z $(grep "${rc}" "${remote}.blacklist") ]]; then
git show -s --format="%cI ${remote} %H" "${rc}" >> "${cherrypick_set}"

git show -s --format="%cI $(printf "%03d" ${picked}) ${remote} %H" "${rc}" >> "${cherrypick_set}"
(( ++picked ))
fi
done
Expand Down
4 changes: 2 additions & 2 deletions scripts/sync_pop_candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ function pop() {
exit
fi
readarray -t rcs < <(echo "$rc" | tr " " "\n")
remote="${rcs[1]}"
remote="${rcs[2]}"
subtree_dir="staging/${remote}"
rc="${rcs[2]}"
rc="${rcs[3]}"
printf 'popping: %s\n' "${rc}"

# Cherrypick the commit
Expand Down