1
0
Fork 0
This commit is contained in:
mfranz 2007-03-06 21:23:26 +00:00
parent 937e8283a3
commit d719f7ac63

View file

@ -10,8 +10,8 @@
# $ cd $FG_ROOT/Aircraft/foo # $ cd $FG_ROOT/Aircraft/foo
# $ fg-submit # generates foo.tar.bz2 and foo.diff # $ fg-submit # generates foo.tar.bz2 and foo.diff
# #
# The archive contains a copy of the diff, which is only left for # The archive contains a copy of the diff, so the extra diff file
# convenience and doesn't have to be submitted. # shouldn't be sumitted. It's only left for convenience.
SELF=$(basename $0) SELF=$(basename $0)
AIRCRAFT=$(basename $PWD) AIRCRAFT=$(basename $PWD)
@ -29,25 +29,30 @@ function REJECT { echo -e "\e[31m\t- $*\e[m"; }
function diffstat { function diffstat {
# output diff statistics, similar to the "diffstat" utility # output diff statistics, similar to the "diffstat" utility
awk ' awk '
function out() { function dofile() {
if (!file) {
return;
}
if (bin) { if (bin) {
print "\t\tbinary\t\t"file; print "\t\tbinary\t\t"file;
} else { } else {
print "\t+"a"\t-"r"\t!"c"\t"file print "\t+"a"\t-"r"\t!"c"\t"file
at += a; rt += r; ct += c;
} }
a = r = c = 0;
} }
BEGIN { BEGIN {
print "\tadded___removed_changed___________________________________"; print "\tadded___removed_changed___________________________________";
a = r = c = at = rt = ct = n = bin = 0; a = r = c = at = rt = ct = n = bin = 0;
} }
/^Index: / { if (file) { out() } a = r = c = scan = bin = 0; file = $2; n += 1 } /^Index: / { dofile(); scan = bin = 0; file = $2; n += 1; next }
/^@@/ { scan = 1 } /^@@/ { scan = 1; next }
/^Binary/ { if (!scan) { bin = 1 } } /^Binary/ { if (!scan) { bin = 1 } next }
/^+/ { if (scan) { a += 1; at += 1 } } /^+/ { if (scan) { a += 1 } next }
/^-/ { if (scan) { r += 1; rt += 1 } } /^-/ { if (scan) { r += 1 } next }
/^!/ { if (scan) { c += 1; ct += 1 } } /^!/ { if (scan) { c += 1 } next }
END { END {
if (file) { out() } dofile();
print "\t-----------------------------------total------------------"; print "\t-----------------------------------total------------------";
print "\t+"at"\t-"rt"\t!"ct"\tin "n" files" print "\t+"at"\t-"rt"\t!"ct"\tin "n" files"
} }
@ -104,34 +109,33 @@ if [ -f $TMP/include ]; then
done done
fi fi
grep "^? " $TMP/up|while read i; do grep "^? " $TMP/up|while read i; do
FILE=${i#? } find ${i#? } -type f >>$TMP/files
find $FILE -type f >> $TMP/files
done done
# classify and filter files # classify and filter files
if [ -f $TMP/files ]; then if [ -f $TMP/files ]; then
for FILE in $(cat $TMP/files); do for i in $(cat $TMP/files); do
case "$FILE" in case "$i" in
$ARCHIVE*|$DIFF*) # don't add files generated by the script $ARCHIVE*|$DIFF*) # don't add files generated by the script
;; ;;
*/.*|.*) # silently drop hidden files */.*|.*) # silently drop hidden files
;; ;;
*~|*.bak|*.orig|*..) *~|*.|*.bak|*.orig)
REJECT "$FILE\t\t(backup file)" REJECT "$i\t\t(backup file)"
;; ;;
*CVS/*) CVS/*|*/CVS/*)
REJECT "$FILE\t\t(CVS file)" REJECT "$i\t\t(CVS file)"
;; ;;
*.blend|*.blend[0-9]|*.blend[0-9][0-9]) *.blend|*.blend[0-9]|*.blend[0-9][0-9])
REJECT "$FILE\t\t(blender file)" REJECT "$i\t\t(blender file)"
;; ;;
*.xcf|*.tga|*.bmp|*.BMP|*.png) *.xcf|*.tga|*.bmp|*.BMP|*.png)
REJECT "$FILE\t\t(graphics file)" REJECT "$i\t\t(graphics file)"
;; ;;
*) *)
ADD "$FILE" ADD "$i"
echo "$FILE" >> $TMP/include echo "$i" >>$TMP/include
;; ;;
esac esac
done done
@ -142,7 +146,7 @@ if [ -f $TMP/include ]; then
LOG "creating archive $ARCHIVE" LOG "creating archive $ARCHIVE"
tar -cjf $ARCHIVE --files-from $TMP/include tar -cjf $ARCHIVE --files-from $TMP/include
else else
LOG "no changes or new files detected" LOG "no changed or new files detected"
fi fi
exit 0 exit 0