How do you revert ONLY directories in an SVN working copy?

谁说我不能喝 提交于 2019-12-03 10:11:06

You could use find combined with svn revert:

find . -type d | grep -v .svn | xargs svn revert

This won't touch any files inside the directories unless you use the -Roption (which is equivalent of --depth=infinity).

ian

Works on all platforms:

svn revert . --recursive

(Note that this will revert everything, not just directories.)

Firstly, make a copy of your working copy somewhere safe. :)

You can edit properties on svn working copies using commands like this:

REM Delete all mergeinfo properties recursively
svn propdel svn:mergeinfo -R

On Windows from the command line you could do this:

for /d /r %i in (*) do svn revert %i

If you call that from a batch file use %%i instead. Please back up first!

This command is dirty and will go through all directories, even unmodified ones or the ones not under svn. You could use something like this Ruby script to do in a cleaner way:

`svn st`.split("\n").grep(/^ M\s+(.*)/) { $1 }.find_all { |i| File.directory? i }.each do |i|
  system "svn revert #{i}"
end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!