svn status --no-ignore | grep '^[I?]' | cut -c 9- | while IFS= read -r f; do rm -rf "$f"; done
Esto tiene las siguientes características:
- Ambos ignorados y archivos sin seguimiento se eliminan
- Funciona incluso si un nombre de archivo contiene espacios en blanco (con excepción de salto de línea, pero no hay mucho que se pueda hacer al respecto aparte de utilizar la opción
--xml
y analizar la salida XML resultante)
- funciona incluso si
svn status
imprime otros caracteres de estado antes del nombre del archivo (que no debería porque no se rastrean los archivos, pero por si acaso ...)
- que debería funcionar en cualquier sistema compatible con POSIX
Yo uso un script llamado svnclean
que contiene lo siguiente:
#!/bin/sh
# make sure this script exits with a non-zero return value if the
# current directory is not in a svn working directory
svn info >/dev/null || exit 1
svn status --no-ignore | grep '^[I?]' | cut -c 9- |
# setting IFS to the empty string ensures that any leading or
# trailing whitespace is not trimmed from the filename
while IFS= read -r f; do
# tell the user which file is being deleted. use printf
# instead of echo because different implementations of echo do
# different things if the arguments begin with hyphens or
# contain backslashes; the behavior of printf is consistent
printf '%s\n' "Deleting ${f}..."
# if rm -rf can't delete the file, something is wrong so bail
rm -rf "${f}" || exit 1
done
Posible duplicado de [eliminar automáticamente los archivos sin versión de Subversion] (http://stackoverflow.com/questions/239340/automatically-remove-subversion-unversioned-files) –