Svn automatically commits the file

I want to write a batch file that can automatically transfer a missing file recursively. how to write a batch command? please, help.

+4
source share
5 answers

The following batch of script should SVN delete and commit all files marked as missing (i.e. deleted locally, but not using SVN removal):

@echo off svn status | findstr /R "^!" > missing.list for /F "tokens=2 delims= " %%A in (missing.list) do ( svn delete %%A && svn -q commit %%A --message "deleting missing files") 

Missing files are displayed with svn status symbol ! , eg:

  !  test.txt

This script then uses findstr to filter any changes except missing files. This list of missing files is then written to the missing.list file.

Then we iterate over this file using tokens=2 delims= to remove ! from the lines in the file, leaving us (hopefully) only the file name. As soon as we have the file name, we will pass it svn delete and then svn commit . Feel free to modify the contents of the message.

Please note that I have not verified this script. In particular, I don’t know what happens if one of the files you want to commit has a space in its path or what happens if you come across a part of the path conflict. It might be better to replace svn delete and svn commit with echo svn delete and echo svn commit so you can see what this script is about to do before you release it in your repository.

+6
source

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

See http://geryit.com/blog/2011/03/command-line-subversion-practices/ for additional subversion on the command line

+10
source

just run the following commands at the root of your working copy:

  svn add . --force svn commit -m"Adding missing files" 
0
source

Arst

 for /f "usebackq tokens=2*" %i in (svn st ^| findstr /R "^!") do svn del "%i" 

almost right, but you forgot to wrap the commands in brackets with reverse ticks:

 for /f "usebackq tokens=2*" %i in (`svn st ^| findstr /R "^!"`) do svn del "%i" 

Thanks for the brief command, anyway.

0
source

I made small changes to my work.

 @echo off cd c:\project for /f "usebackq tokens=2*" %%i in (\`svn st ^| findstr /R "^!"\`) do svn del "%%i %%j" 

then

 svn commit . -m test 

This works for me. Thanks.

0
source

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


All Articles