Reputation: 32031
I have a folder which is a checkout of a SVN repository. The files in this folder are changed very often, new files get created and old files are deleted.
How can I easily commit all changes in the repository to the remove svn server? Typically I first would have to issue svn delete [all deleted files and directories recursivly]
, then svn add [all added files and directories recursivly]
and then svn ci
for commit. Can this somehow be automated?
I thought about creating a bash-script which parses svn status
, but there must be a better solution?!
One thing is important: the svn-ignore properties must NOT be ignored.
Upvotes: 4
Views: 1194
Reputation: 32031
Thanks to DerVO
for the answer, I wrote the following script which first deletes all files and then adds all new one. For savety purposes the delete-command asks for every file (because svn delete
physically deletes the file)
#!/bin/bash
HERE=$(cd $(dirname ${BASH_SOURCE[0]}) > /dev/null && pwd)
PROG="${0##*/}"
cd $HERE
svn status | grep ^\! | sed 's/^\!\s*//' | tr '\n' '\0' | xargs -0 -n 1 -pr svn remove
svn status | grep ^\? | sed 's/^\?\s*//' | tr '\n' '\0' | xargs -0 -n 1 -pr svn add
svn commit -m "Work of `date`"
svn up
Upvotes: 1
Reputation: 3679
At least for the deletion task parsing svn status
is the solution, but it can be done very quickly:
svn delete $( svn status | sed -e '/^!/!d' -e 's/^!//' )
The adding can also be done the same way:
svn add $( svn status | sed -e '/^?/!d' -e 's/^?//' )
-or- even more simple:
svn add . --force
btw: Both stated svn add
commands consider your svn:ignore
properties and don’t add ignored files.
Upvotes: 4