nightly build: Move shell code for listing files under source control into a separate file

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4449 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-08-07 11:40:09 +00:00
parent 2df95bda26
commit 8df49947fa
3 changed files with 52 additions and 6 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/bin/bash
list_source_files() {
local r
r="$1"
while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do
r="$(dirname "$r")"
done
if [ -e "$r/.svn" ]; then
(
cd "$1"
svn status -v | \
grep -vE '^[D?]|^Performing|^$' | \
cut -c41- | \
while read f; do
if [ -f "$f" ]; then
echo "$f"
fi
done
)
elif [ -e "$r/.git" ]; then
git_dir="$PWD"
while [ "$git_dir" != "" -a ! -e "$git_dir/.git" ]; do
git_dir="$(dirname "$git_dir")"
done
subdir="${PWD#${git_dir}}"
if [ "$git_dir" != "" ]; then
git ls-tree --name-only -r HEAD | sed "s|^$subdir/||"
else
echo "Ignored directory $PWD" >&2
fi
elif [ -e "$r/.hg" ]; then
hg manifest
else
echo "Not under source control: $PWD ?" >&2
fi
}
if [ $# = 0 ]; then
list_source_files "$PWD"
else
for d in "$@"; do list_source_files "$d"; done
fi