Fetch ghosts

The following is a script I used for correcting the dangling ghosts left in the Bzr archives from the conversion from tla to bzr via baz-import.

MY_VERBOSE="0"
MY_PREFIX="/home/ftp/fmios/archives/bzr"
set -- ajdranse-vsta amatus-fmios amatus-vsta dalen-fmios dalen-vsta fmios-pqm lethal-vsta major-fmios major-vsta oxygene-2003 oxygene-2004 wkt-fmios
for arch in "$@" ; do
        for dest in $(find "${MY_PREFIX}/${arch}"/* -type d -name '.bzr'); do
                cd "${dest%.bzr}"
                [ "${MY_VERBOSE}" -eq "1" ] &&  echo "Processing '${arch}'"
                for src in "$@" ; do
                        if [ "${src}" = "${arch}" ]; then
                                [ "${MY_VERBOSE}" -eq "1" ] && echo "Skipping '${src}'"
                                continue
                        fi
                        for dir in $(find "${MY_PREFIX}/${src}"/* -type d -name '.bzr'); do
                                [ "${MY_VERBOSE}" -eq "1" ] && echo "Fetching ghosts: '${dir%.bzr}' -> '${dest%.bzr}'"
                                bzr fetch-ghosts "${dir%.bzr}" || break
                        done
                done
        done
done

Also available in: HTML TXT