开发者

svn to auto-update based my dir without manually "svn rm ..."

Is there a svn command to tell the repository to automatically “rm” files in repo that exist in the repo but not in my dir?

a bit explanation:

i have my own project hosted on google code. In my local dir, i've deleted many files. Now, i want to commit. However, i don't remember which files i've removed. It seems quite cumbersome to find out (by e.g. backup my dir, update the dir, and diff the dirs, then generate a file list to “svn rm f1 f2 ...”)

i know that in svn that开发者_开发问答 proper way to remove a file is to first call “svn rm fname”, which will delete the file for you. But long story short... i have the above situation.


I just tried the following on my Mac OS X system and it seemed to work:

$ svn status -q | grep '! ' | awk '{ print $2 }' | xargs svn rm

This doesn't commit anything, just issues the svn rm command(s) for you. Hope this helps!

EDIT: This does not correctly handle files with spaces in the name (e.g. "My text file.txt"), but it should work for whitespace-free file names.


This SHOULD work. Use at your own risk - better create a backup before you run it:

svn st | grep "^!" | gawk '{print $2}' | xargs svn rm


Not that I know of.

svn status gives you an overview of the current status of your working directory. Files prefixed with a ! are missing (removed, but not svn rm'd).


If you commit your working copy's root folder, Subversion should notice that the files are missing in the working copy. At least TortoiseSVN offers to delete those files from the repo as well - I don't know how the command line client handles this.


You could have done svn up, select the list and then svn rm the recovered files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜