如何在出现确认提示后删除 SVN 目录?
我希望能够从目录中删除 .SVN 文件夹。
我发现以下注册表黑客可以让您做到这一点...
http://weblogs.asp.net/jgalloway/archive/2007/02/24/shell-command-remove-svn-folders.aspx
然而,我不喜欢这个解决方案的是它根本不提供任何确认。我希望它执行此 cmd 脚本的操作,但首先会收到确认提示。
有什么想法吗?
编辑 我的理解是 SVN Export 不会复制未版本化的文件。这就是我提出这个要求的原因。
赛斯
I want to be able to remove the .SVN folders from a directory.
I found the following registry hack that will allow you to do just that...
http://weblogs.asp.net/jgalloway/archive/2007/02/24/shell-command-remove-svn-folders.aspx
However, the one thing I don't like about this solution is that it gives NO CONFIRMATION at all. I would like it to do what this cmd script does but get a confirmation prompt first.
Any ideas at all?
EDIT
My understanding is that SVN Export does not copy out the unversioned files. That is why I ask for this.
Seth
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以使用 Subversion 命令行并运行
svn export
如果您使用 TortoiseSVN,则可以使用 这个。You can use the Subversion command line and run
svn export
If you are using TortoiseSVN, you can use this.尝试对脚本进行此修改。它在运行目录删除之前添加一个提示:
Try this modification of the script. It adds a single prompt before running the directory deletions:
删除隐藏在该脚本中的 RD 命令上的 /q 选项。
这应该会导致每次调用 rd (删除目录)时询问...
但同时,我会问为什么你不使用 svn 导出选项。
Remove the /q option on the RD command buried in that script.
That should cause each invocation of rd (remove directory) to ask...
At the same time, though, I'd ask why you don't use the svn export option instead.
如果将脚本的内容放入 cmd 文件,然后设置注册表以使其指向该 cmd 文件会怎么样?然后,您可以添加各种操作,例如 Wikipedia 中的示例。我希望这可以帮助您创建解决方案。
What if you put content of the script to the cmd file and then set registry so that it points to this cmd file? Then you could add various actions like in the examples at Wikipedia. I hope this helps you to create a solution.
如果你完全使用 Perl,这里有一个我用来执行此操作的小脚本,再加上取出其他目录类型(对于 /bin 等很方便,来自 VS):
If you use Perl at all, here's a little script I have for doing this, plus taking out other dir types (handy for /bin, etc.. from VS):
尝试使用 Powershell 命令获取 reg 值:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& {if ((read-host '确认删除 .SVN 文件夹。按 Y 或N') -eq 'y') { Get-ChildItem '%1' -r *.svn | ?{$_.PSIsContainer} | 删除项目 -r -force -verbose -ea 0;退出' }}"
如果您不想看到文件被删除,请删除 -verbose。
Try this for the Powershell command for the reg value:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& {if ((read-host 'Confirm deletion of .SVN folder. Press Y or N') -eq 'y') { Get-ChildItem '%1' -r *.svn | ?{$_.PSIsContainer} | Remove-Item -r -force -verbose -ea 0; Read-Host 'Press enter to exit' }}"
Remove the -verbose if you don't want to see the files deleted.