如何仅恢复 SVN 工作副本中的目录?
我想恢复 SVN 工作副本中的目录和所有子目录,以便它们与存储库匹配,但我不想触及这些目录中的任何文件。
我的一个 SVN 应用程序在工作副本中的每个目录上递归地设置 SVN 属性,但我想恢复这些更改以阻止它突出显示它们并尝试将更改提交到 SVN 属性。简单地改变它以匹配 HEAD 是行不通的。
有什么想法吗?我已经阅读了各种 SVN 资源,但似乎没有一个能够处理这种边缘情况。
I want to revert a directory and all sub-directories in an SVN working copy so they match the repository but I don't want to touch any files inside those directories.
One of my SVN applications recursively set an SVN property on every directory in my working copy but I want to revert those changes to stop it highlighting them and trying to commit the changes to the SVN properties. Simply changing it to match the HEAD doesn't work.
Any ideas? I've read through various SVN resources but none of them seem to deal with this edge case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
适用于所有平台:
(请注意,这将恢复所有内容,而不仅仅是目录。)
Works on all platforms:
(Note that this will revert everything, not just directories.)
您可以将
find
与svn revert
结合使用:除非您使用
-R
选项(即相当于--深度=无穷大
)。You could use
find
combined withsvn revert
:This won't touch any files inside the directories unless you use the
-R
option (which is equivalent of--depth=infinity
).首先,将工作副本复制到安全的地方。 :)
您可以使用如下命令编辑 svn 工作副本的属性:
Firstly, make a copy of your working copy somewhere safe. :)
You can edit properties on svn working copies using commands like this:
在 Windows 上,您可以从命令行执行此操作:
如果您从批处理文件调用该命令,请改用
%%i
。 请先备份!此命令脏,将遍历所有目录,甚至包括未修改的目录或不在
svn
下的目录。您可以使用类似以下 Ruby 脚本的方式以更简洁的方式执行操作:On Windows from the command line you could do this:
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: