Skip to content

Instantly share code, notes, and snippets.

@nestserau
Last active March 13, 2018 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nestserau/ab7d48e857811e1ef808 to your computer and use it in GitHub Desktop.
Save nestserau/ab7d48e857811e1ef808 to your computer and use it in GitHub Desktop.
Subversion script to add all unadded and remove all unremoved files.
#!/bin/bash
usage()
{
printf "Supported commands:\n\tadd - adds all new files\n\tremove - removes all deleted files\n\tdiff - colorized diff\n"
exit 1
}
if [ "$#" -eq "0" ]; then usage; fi
if [ $1 == "add" ]; then
svn st | grep ^? | sed 's/^\? *//' | xargs -I% svn add %@
elif [ $1 == "remove" ]; then
svn st | grep ^! | sed 's/\! *//' | xargs -I% svn rm %@
elif [ $1 == "diff" ]; then
svn diff | colordiff
else
usage
fi
@nestserau
Copy link
Author

Allows spaces in file names.

@nestserau
Copy link
Author

svn add %@ command allows to have at-signs in the path (which otherwise are treated as a peg revision).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment