清理 svn 签出(删除非 svn 文件)
我想删除我的工作副本中 svn 存储库中未知的所有文件。
实际上就好像我刚刚进行了一次干净的结帐,但我不想重新下载所有文件。
我最接近的想法是......
rm -rf `svn st | grep "^?" | cut -d" " -f8`
但这看起来很笨重,我并不完全相信它,因为输出不一致可能会删除 svn 之外的目录。
“svn导出”不是我想要的,因为我没有清理源代码来打包它,我只想删除大部分内容(*.pyc,*.orig,*.rej,svn-commit.tmp,* .swp)。
除了干净的结帐之外,还有更好的方法吗?
Id like to remove all files in my working copy that are not known in the svn repository.
Effectively as if I'd just made a clean checkout, but Id rather not have to re-download all files.
The closest think I've come to this is...
rm -rf `svn st | grep "^?" | cut -d" " -f8`
But this seems clunky and I don't totally trust it since inconsistency in output could remove dirs outside svn.
"svn export" isn't what Im looking for because I'm not cleaning the source to package it, I just want to remove cruft mostly (*.pyc, *.orig, *.rej, svn-commit.tmp, *.swp).
Is there a better way to do this besides making a clean checkout?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
此处发布的大多数解决方案无法处理带有空格的文件夹。这就是我们使用这个的原因:
Most solutions that are posted here fail to handle folders with whitespaces. This is why we use this one:
http://www.cuberick.com/2008 /11/clean-up-your-subversion-working-copy.html
http://www.cuberick.com/2008/11/clean-up-your-subversion-working-copy.html
让我解释一下。
获取存储库中文件的状态并将它们一一打印到标准输出到数组中
这包括设置为通常被 svn 忽略的文件
匹配包含 ? 的行或“我”作为一种状态。我的意思是一个被忽略的文件和?表示不受 svn 控制的文件。
这将打印数组中的第二个变量,即文件名
这将删除具有打印文件名的文件
干杯,
环形
Let me explain.
Get the status of the files in a repository and prints them out one by one to standard output into an array
This includes files set to normally be ignored by svn
Match lines that include either a ? or a I as a status. I means an ignored file and ? means a file not under svn control.
This prints the second variable in the array which is the filename
This removes the files with the printed filesnames
Cheers,
Loop
使用这个:
从 commandlinefu 获取。
Use this:
Obtained from commandlinefu.
删除所有不具有只读属性的文件?确保你没有事先检查过东西...
Delete every file that doesn't have the readonly attribute? Make sure you don't have things checked out beforehands...