Created
December 15, 2016 08:51
-
-
Save chmodsss/a830212c4df4c1aaaf84dbd2d33e52e3 to your computer and use it in GitHub Desktop.
Bash script to copy svn properties between two different repositories.
This file contains 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/sh | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
SRC_PATH=path/to/source/folder | |
DST_PATH=path/to/destination/folder | |
for src_dir in $(ls $SRC_PATH) | |
do | |
for src_file in $(ls $SRC_PATH/$src_dir) | |
do | |
src_fpath=$SRC_PATH/$src_dir/$src_file | |
dst_fpath=$DST_PATH/$src_dir/$src_file | |
if [ -f $dst_fpath ] | |
then | |
echo 'Processing File : '$src_dir/$src_file | |
SRC_PROP=`svn pl $src_fpath | sed -n '2,$p' | xargs` | |
SRC_VALUE=`svn pg $SRC_PROP "$src_fpath"` | |
DST_PROP=`svn pl $dst_fpath | sed -n '2,$p' | xargs` | |
if [ $DST_PROP ] && [ $DST_PROP == svn:mime-type ] | |
then | |
echo "Deleting existing mime property" | |
svn propdel svn:mime-type "$dst_fpath" | |
fi | |
svn ps $SRC_PROP "$SRC_VALUE" "$dst_fpath" | |
fi | |
done | |
done | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment