Lock everything for SVN Repo

I have a folder that is an SVN repository check. Files in this folder change very often, new files are created and old files are deleted.

How can I easily make all changes to the repository on the remote svn server? Usually I had to release svn delete [all deleted files and directories recursivly] , then svn add [all added files and directories recursivly] , and then svn ci for commit. Could this be automated?

I was thinking of creating a bash - script that parses svn status , but there should be a better solution ?!

One thing is important: svn-ignore properties should NOT be ignored.

+4
source share
2 answers

At least to solve the removal task, svn status is a solution, but it can be done very quickly:

 svn delete $( svn status | sed -e '/^!/!d' -e 's/^!//' ) 

Adding can also be done as follows:

 svn add $( svn status | sed -e '/^?/!d' -e 's/^?//' ) 

-or- even easier:

 svn add . --force 

btw: Both of these svn add commands examine your svn:ignore properties and do not add ignored files.

+4
source

Thanks to DerVO for the answer, I wrote the following script, which first deletes all the files, and then adds everything new. For useful purposes, the delete command asks for each file (since 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 
+1
source

Source: https://habr.com/ru/post/1391007/


All Articles