我们正在使用脚本将代码从主干复制到分支,并从同一个仓库中的一个分支复制到另一个分支。使用rev no。我们正在更改文件,然后仅导出这些文件。我希望以某种方式实现脚本,以便它可以通过文件立即从用户获得多次转速并继续运行直到所有转速完成。此外,对于每个rev,它应该复制指定rev的完整提交消息并将其作为当前消息提供。
#!/bin/bash
output=`ps -ef | grep svn | wc -l`
if [ "$output" -gt "3" ] ; then
echo "Svn script already running on another machine"
exit 0;
else
echo "Processing"
read -p "revision - " revision
read -p "message - " message
read -p "username - " username
stty -echo
read -p "password - " password
stty echo
echo "";
echo "Updating working copy"
/usr/bin/svn up /QA/ --username $username --password $password --non-interactive
/usr/bin/svn log --verbose -r "$revision" http://192.168.62.224/live/repos --username $username --password $password --non-interactive | grep trunk | awk '{print $2}' > /opt/trunk-list.txt
cp /opt/trunk-list.txt /opt/ren.txt
sed -i 's/trunk/home/g' /opt/ren.txt
cat /opt/trunk-list.txt | while read line
do
found=`echo $line | cut -c 7-`
dest="/QA$found"
/usr/bin/svn export http://192.168.62.224/live/repos/$line $dest --force --username $username --password $password --non-interactive
/usr/bin/svn add $dest --force
done
cd /QA/
/usr/bin/svn commit -m "$message |Dev:$revision" --username $username --password $password --non-interactive
# For update SVN working copy
cat /opt/ren.txt | while read file
do
svn up $file --username $username --password $password --non-interactive
done
fi