Add a script for importing svn:ignore props
This commit is contained in:
parent
670fea4047
commit
8e47e41112
1 changed files with 37 additions and 0 deletions
37
scripts/import-from-svn/import-svn-ignore.sh
Executable file
37
scripts/import-from-svn/import-svn-ignore.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
readonly svn_url=https://svn.code.sf.net/p/dosbox/code-0/dosbox
|
||||
|
||||
list_directories () {
|
||||
find . -type d | grep -v "./.git"
|
||||
}
|
||||
|
||||
svn_ignore_content () {
|
||||
echo "# svn:ignore"
|
||||
svn propget svn:ignore "$svn_url/trunk/$1"
|
||||
}
|
||||
|
||||
update_svn_ignore_files () {
|
||||
while read -r dir ; do
|
||||
echo "Reading svn:ignore for: $dir"
|
||||
svn_ignore_content "$dir" > "$dir/svn-ignore"
|
||||
|
||||
if [ ! -f "$dir/.gitignore" ] ; then
|
||||
echo "New file (add)"
|
||||
mv "$dir/svn-ignore" "$dir/.gitignore"
|
||||
git add "$dir/.gitignore"
|
||||
continue
|
||||
fi
|
||||
|
||||
if diff "$dir/.gitignore" "$dir/svn-ignore" > /dev/null ; then
|
||||
echo "No change (skip)"
|
||||
rm "$dir/svn-ignore"
|
||||
else
|
||||
echo "File differs (merge $dir/.gitignore and $dir/svn-ignore manually)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)" || exit
|
||||
|
||||
list_directories | update_svn_ignore_files
|
Loading…
Add table
Reference in a new issue