[ 
https://issues.apache.org/jira/browse/CASSANDRA-18399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17709019#comment-17709019
 ] 

Ekaterina Dimitrova commented on CASSANDRA-18399:
-------------------------------------------------

I can run it on a Mac. 

Just a few initial thoughts while reading it here:

1) Why do you cherry-pick at all CircleCI changes which are throwaway commit?

2) I am wondering, do we want maybe to add a dry-run -n option for the script? 
Potentially with git diff or so to encourage people to verify changes pre - 
commit? (Now this will be probably an option for committers only though)

3) Probably we can add also 
{code:java}
ant realclean && ant jar build-test{code}
after applying a patch to a branch as per our [commit 
process|https://cassandra.apache.org/_/development/how_to_commit.html]?

4) Why is this in cassandra-builds? I know we try to move to in-tree as much as 
possible, though I understand that the it can drift in time between branches. 
But I wouldn't expect that to be an issue as since the 3 years and a half I am 
working on Cassandra we didn't change anything in the merge strategy even once.

 

Started running the 3.0 script and got an error:

 
{code:java}
git cherry-pick -n 99e96a4f95 && git commit -a --amend --no-edit
src/java/org/apache/cassandra/db/SystemKeyspace.java: unmerged 
(dc550dfdc7870b5f176487467e588f320d5b8c8e)
src/java/org/apache/cassandra/db/SystemKeyspace.java: unmerged 
(c0bf31779b9c30765bb06191788953ccce46b9cb)
src/java/org/apache/cassandra/db/SystemKeyspace.java: unmerged 
(eaa9ad32af1b460dec1a02c7184798b42ce0aecd)
error: your index file is unmerged.
fatal: cherry-pick failed
{code}
 

> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to