Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn commit missing file automatically

Tags:

svn

I want to write a batch file that can auto commit missing file recursively. how to write the batch command? please helps.

like image 666
Arst Avatar asked Feb 18 '11 10:02

Arst


People also ask

Does svn commit push?

Correct, svn commit will push your local modifications to the server. Take a look at the Basic Work Cycle to get a quick-ish overview of the commands you'll typically use.

How check svn commit history?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

How do I commit all files in svn?

svn list <URL> Lists all the files available in the given URL in the repository without downloading a working copy. svn add <filename> Use this command to add new files or changed files to the commit list. svn commit m “Commit message” Commit the added files using a commit message for better traceability.


2 Answers

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

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

like image 164
goksel Avatar answered Oct 27 '22 21:10

goksel


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

@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 shown by svn status with the character !, for example:

!      test.txt

This script then uses findstr to filter out any modifications other than missing files. This list of missing files is then written to a file, missing.list.

Next, we iterate through this file, using tokens=2 delims= to remove the ! from the lines in the file, leaving us with (hopefully) just the filename. Once we have the filename, we pass it to svn delete and then svn commit. Feel free to change the contents of the message.

Please note that I have not tested this script. In particular, I don't know what happens if one of the files you wish to commit has a space in its path, or what happens if you encounter a conflict part of the way through. It may be better to replace svn delete and svn commit with echo svn delete and echo svn commit, so that you can see what this script is about to do before you let it loose on your repository.

like image 36
Luke Woodward Avatar answered Oct 27 '22 20:10

Luke Woodward