Created
July 9, 2024 01:59
-
-
Save ccarouge/8c6df6883d93734cf7575c415a81c3ae to your computer and use it in GitHub Desktop.
git svn a subset of branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| svn_src_name=cable_src | |
| # Copy all the branches we want to a single location in SVN | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/inh599/BLAZE_9184 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/BLAZE_9184 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Share/CABLE-POP_TRENDY https://trac.nci.org.au/svn/cable/branches/Share/ccc561/CABLE-POP_TRENDY -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/ms8355/CableHydraulics https://trac.nci.org.au/svn/cable/branches/Share/ccc561/CABLEHydraulics -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/ccc561/calendar_fix https://trac.nci.org.au/svn/cable/branches/Share/ccc561/calendar_fix -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/rk4417/DevBr-1 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/DevBr-1 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/rk4417/DevBr-2 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/DevBr-2 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/mm3972/Marks_latest_branch_with_fixes_mmy_trunk https://trac.nci.org.au/svn/cable/branches/Share/ccc561/Marks_latest_branch_with_fixes_mmy_trunk -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Share/NESP2pt9_BLAZE https://trac.nci.org.au/svn/cable/branches/Share/ccc561/NESP2pt9_BLAZE -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Share/NESP2pt9_CROP https://trac.nci.org.au/svn/cable/branches/Share/ccc561/NESP2pt9_CROP -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/inh599/Ticket334 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/Ticket334 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/inh599/Ticket337 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/Ticket337 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/branches/Users/inh599/Ticket339 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/Ticket339 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/tags/CABLE-2.4-ACCESS-ESM1.5 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/CABLE-2.4-ACCESS-ESM1.5 -m "Copy for moving to git" | |
| #svn copy --parents https://trac.nci.org.au/svn/cable/tags/CABLE-2.5-ACCESS-CM2 https://trac.nci.org.au/svn/cable/branches/Share/ccc561/CABLE-2.#5-ACCESS-CM2 -m "Copy for moving to git" | |
| # | |
| # Clone the trunk and the branches copied above. | |
| git svn clone https://trac.nci.org.au/svn/cable -T trunk -b branches/Share/ccc561/ ${svn_src_name} | |
| # Clean up the cable repository: | |
| # - create the local branches as needed | |
| # - reset all to HEAD^1 so there isn't the recent copy commit | |
| # List of all the branches we want. `sed` removes the trailing `/`. | |
| branches=`svn ls https://trac.nci.org.au/svn/cable/branches/Share/ccc561/ | sed 's/.$//' ` | |
| cd ${svn_src_name} | |
| for br in ${branches} | |
| do | |
| echo removing last commit from ${br} | |
| git checkout -b ${br} origin/${br} | |
| git reset --hard HEAD^1 | |
| echo | |
| done | |
| cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment