You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jacek Lewandowski (Jira)" <ji...@apache.org> on 2023/09/25 10:59:00 UTC
[jira] [Commented] (CASSANDRA-18399) Add simple helper script for commiting a change to multiple branches
[ https://issues.apache.org/jira/browse/CASSANDRA-18399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768633#comment-17768633 ]
Jacek Lewandowski commented on CASSANDRA-18399:
-----------------------------------------------
Now the script also does the following:
- fetches the assignee name from the Jira ticket
- fetches the reviewers list from the Jira ticket
- generates a commit message with the commonly used pattern:
{noformat}
first commit title
first commit body
other commit titles and bodies
Patch by <assignee-name-from-jira>; reviewed by <list of reviewers from jira> for CASSANDRA-XYZ
{noformat}
it opens the editor allowing the user to edit the message and use the message title for updating CHANGES.txt if requested.
> Add simple helper script for commiting a change to multiple branches
> --------------------------------------------------------------------
>
> Key: CASSANDRA-18399
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18399
> Project: Cassandra
> Issue Type: Task
> Components: Build
> Reporter: Jacek Lewandowski
> Assignee: Jacek Lewandowski
> Priority: Low
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> This is just a simple additional script which committers can use to help them merge commits, especially if the change applies to multiple Cassandra versions.
> For example, for CASSANDRA-18153, which applies to 3.0..trunk, it generates the following commands, which then can be run manually:
> {noformat}
> git fetch origin
> git fetch jacek-lewandowski
> # jacek-lewandowski/CASSANDRA-18153-3.0 -> cassandra-3.0
> # --------------------------------------------------------------------------------------------------------
> git switch cassandra-3.0
> git reset --hard origin/cassandra-3.0
> git cherry-pick e7e9b42559 # e7e9b42559 Save host id to system.local and flush immediately after startup
> git cherry-pick -n 99e96a4f95 && git commit -a --amend --no-edit # 99e96a4f95 fixes
> git cherry-pick -n c63e3f29f1 && git commit -a --amend --no-edit # c63e3f29f1 DO NOT MERGE - CircleCI config
> grep 'CASSANDRA-18153' CHANGES.txt || sed -E -i '/^[0-9]+\.[0-9]+/{s/.*/&\n\ * Save host id to system.local and flush immediately after startup (CASSANDRA-18153)/;:a;n;ba}' CHANGES.txt
> git diff CHANGES.txt
> git add CHANGES.txt
> git commit --amend --no-edit
> (git diff origin/cassandra-3.0..HEAD -- .circleci/ | git apply -R --index) && git commit -a --amend --no-edit # Remove all changes in .circleci directory if you need to
> git diff --name-only origin/cassandra-3.0..HEAD # print a list of all changes files
> # jacek-lewandowski/CASSANDRA-18153-3.11 -> cassandra-3.11
> # --------------------------------------------------------------------------------------------------------
> git switch cassandra-3.11
> git reset --hard origin/cassandra-3.11
> git merge -s ours --log --no-edit cassandra-3.0
> git cherry-pick -n 79e7b90c8f && git commit -a --amend --no-edit # 79e7b90c8f Save host id to system.local and flush immediately after startup
> git cherry-pick -n bdca4c384b && git commit -a --amend --no-edit # bdca4c384b fixes
> git cherry-pick -n 45078e6793 && git commit -a --amend --no-edit # 45078e6793 DO NOT MERGE - CircleCI config
> grep 'CASSANDRA-18153' CHANGES.txt || sed -E -i '/^Merged from 3.0/{s/.*/&\n\ * Save host id to system.local and flush immediately after startup (CASSANDRA-18153)/;:a;n;ba}' CHANGES.txt
> git diff CHANGES.txt
> git add CHANGES.txt
> git commit --amend --no-edit
> (git diff origin/cassandra-3.11..HEAD -- .circleci/ | git apply -R --index) && git commit -a --amend --no-edit # Remove all changes in .circleci directory if you need to
> git diff --name-only origin/cassandra-3.11..HEAD # print a list of all changes files
> # jacek-lewandowski/CASSANDRA-18153-4.0 -> cassandra-4.0
> # --------------------------------------------------------------------------------------------------------
> git switch cassandra-4.0
> git reset --hard origin/cassandra-4.0
> git merge -s ours --log --no-edit cassandra-3.11
> git cherry-pick -n 2227c5c7af && git commit -a --amend --no-edit # 2227c5c7af Save host id to system.local and flush immediately after startup
> git cherry-pick -n a71d4e3408 && git commit -a --amend --no-edit # a71d4e3408 DO NOT MERGE - CircleCI config
> git cherry-pick -n 6dc53f4e97 && git commit -a --amend --no-edit # 6dc53f4e97 fixes
> grep 'CASSANDRA-18153' CHANGES.txt || sed -E -i '/^Merged from 3.0/{s/.*/&\n\ * Save host id to system.local and flush immediately after startup (CASSANDRA-18153)/;:a;n;ba}' CHANGES.txt
> git diff CHANGES.txt
> git add CHANGES.txt
> git commit --amend --no-edit
> (git diff origin/cassandra-4.0..HEAD -- .circleci/ | git apply -R --index) && git commit -a --amend --no-edit # Remove all changes in .circleci directory if you need to
> git diff --name-only origin/cassandra-4.0..HEAD # print a list of all changes files
> # jacek-lewandowski/CASSANDRA-18153-4.1 -> cassandra-4.1
> # --------------------------------------------------------------------------------------------------------
> git switch cassandra-4.1
> git reset --hard origin/cassandra-4.1
> git merge -s ours --log --no-edit cassandra-4.0
> git cherry-pick -n 3584d17b36 && git commit -a --amend --no-edit # 3584d17b36 Save host id to system.local and flush immediately after startup
> git cherry-pick -n e7b2ca37e6 && git commit -a --amend --no-edit # e7b2ca37e6 DO NOT MERGE - CircleCI config
> git cherry-pick -n 85f3049e90 && git commit -a --amend --no-edit # 85f3049e90 fixes
> grep 'CASSANDRA-18153' CHANGES.txt || sed -E -i '/^Merged from 3.0/{s/.*/&\n\ * Save host id to system.local and flush immediately after startup (CASSANDRA-18153)/;:a;n;ba}' CHANGES.txt
> git diff CHANGES.txt
> git add CHANGES.txt
> git commit --amend --no-edit
> (git diff origin/cassandra-4.1..HEAD -- .circleci/ | git apply -R --index) && git commit -a --amend --no-edit # Remove all changes in .circleci directory if you need to
> git diff --name-only origin/cassandra-4.1..HEAD # print a list of all changes files
> # jacek-lewandowski/CASSANDRA-18153 -> trunk
> # --------------------------------------------------------------------------------------------------------
> git switch trunk
> git reset --hard origin/trunk
> git merge -s ours --log --no-edit cassandra-4.1
> git cherry-pick -n 3b9fa1653e && git commit -a --amend --no-edit # 3b9fa1653e DO NOT MERGE - CircleCI config
> git cherry-pick -n e1389f6196 && git commit -a --amend --no-edit # e1389f6196 Save host id to system.local and flush immediately after startup
> grep 'CASSANDRA-18153' CHANGES.txt || sed -E -i '/^Merged from 3.0/{s/.*/&\n\ * Save host id to system.local and flush immediately after startup (CASSANDRA-18153)/;:a;n;ba}' CHANGES.txt
> git diff CHANGES.txt
> git add CHANGES.txt
> git commit --amend --no-edit
> (git diff origin/trunk..HEAD -- .circleci/ | git apply -R --index) && git commit -a --amend --no-edit # Remove all changes in .circleci directory if you need to
> git diff --name-only origin/trunk..HEAD # print a list of all changes files
> git push --atomic origin cassandra-3.0 cassandra-3.11 cassandra-4.0 cassandra-4.1 trunk -n
> {noformat}
> The generated script takes into account the following:
> - a change can span multiple commits - all of the will be properly squashed (when running a script, you can comment out the commits you don't want to include)
> - when commits leave .circleci directory modified, one of the last commands for each branch reverts those changes
> - the script does its best to update CHANGED.txt properly, to confirm, it always displays the diff for CHANGES.txt
> Note that, the script does not push anything, it just generates the script to be manually run by the committer.
> I'll appreciate if someone can run it on Mac so we know if there are some fixes needed for MacOS.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org