Source

jackpot30 / server / do-indexing

Full commit
#!/bin/bash -x

performIndexing() {
    name=`basename $1`;
    if [ -d $name ] ; then
        HG_OUT=$(tempfile) || exit
        trap "rm -f -- '$HG_OUT'" EXIT
        MODIFIED=$(tempfile) || exit
        trap "rm -f -- '$HG_OUT' '$MODIFIED'" EXIT
        REMOVED=$(tempfile) || exit
        trap "rm -f -- '$HG_OUT' '$MODIFIED' '$REMOVED'" EXIT

        (cd $name; hg pull; hg --verbose up >$HG_OUT; grep <$HG_OUT "^getting " | cut -d ' ' -f 2- >$MODIFIED; grep <$HG_OUT "^removing " | cut -d ' ' -f 2- >$REMOVED;)
        java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2 "$MODIFIED" "$REMOVED"
    else
        hg clone $1
        java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2
    fi;
}

mkdir -p cache

for f in `echo $1 | tr ',' '\n'`; do
    performIndexing $f cache
done

exit