?状态的文件加入忽略列表,支持带空格的文件名

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

folder=$1
if [ -z $folder ]; then
echo "Parameters error"
exit
fi

cd ${folder}

items=`svn st | grep "^\?" | sed -e "s/^\?\ *//"`
IFS='
'

for item in ${items}; do
parent=${item%\/*}
filename=${item##*\/}

if [ -z "${parent}" ]; then
parent='.'
fi

ignore_list=`svn propget svn:ignore "${parent}"`
svn propset svn:ignore "${ignore_list}
${filename}" "${parent}"
done