Created
June 1, 2020 15:12
-
-
Save alpiepho/8da9c10b7fde1352bcbc31a90d9bec95 to your computer and use it in GitHub Desktop.
Script to grab before and after trees from svn status
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 | |
BRANCH="quasar" | |
# get what svn thinks are new and modified files | |
svn status | grep -e '^?' | cut -c 9- > ../packed_svn_add.txt | |
svn status | grep -e '^M' | cut -c 9- > ../packed_svn_mod.txt | |
# copy branch directory and revert modified files | |
cd .. | |
rm -rf ${BRANCH}.reverted | |
cp -rf ${BRANCH} ${BRANCH}.reverted | |
cd ${BRANCH}.reverted | |
while IFS= read -r THELINE; do | |
svn revert "$THELINE" | |
done < ../packed_svn_mod.txt | |
cd .. | |
# start the trees | |
rm -rf packed_diff_trees | |
mkdir packed_diff_trees | |
mkdir packed_diff_trees/tree1 | |
mkdir packed_diff_trees/tree2 | |
cp ./packed_svn_add.txt packed_diff_trees | |
cp ./packed_svn_mod.txt packed_diff_trees | |
#exit | |
# copy mod files from reverted to tree1 | |
while IFS= read -r THELINE; do | |
install -D "${BRANCH}.reverted/${THELINE}" "packed_diff_trees/tree1/${THELINE}" | |
done < ./packed_svn_mod.txt | |
# copy mod files from original to tree2 | |
while IFS= read -r THELINE; do | |
install -D "${BRANCH}/${THELINE}" "packed_diff_trees/tree2/${THELINE}" | |
done < ./packed_svn_mod.txt | |
# copy add files from original to tree2 | |
while IFS= read -r THELINE; do | |
install -D "${BRANCH}/${THELINE}" "packed_diff_trees/tree2/${THELINE}" | |
done < ./packed_svn_add.txt | |
# pack up trees | |
rm packed_diff_trees.tgz | |
tar -czvf packed_diff_trees.tgz packed_diff_trees | |
# back to original | |
cd ${BRANCH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment