如何从存储库中删除所有已删除的文件?

问题描述:

我有一个脚本,我在其中添加所有新文件,然后使用以下行将我的工作副本提交到我的存储库:

I have a script in which I add all new files before to commit my working copy to my repository with this line:

svn status | grep ^\? | awk '{print $2}' | xargs svn add

我现在想添加一行,从存储库中删除我的工作副本中所有已删除的文件.换句话说,我无法一一指定它们,我需要使用 svn status 检测它们,然后自动删除它们.但是线路不起作用.

I now want to add a line that delete from repository all deleted files in my working copy. In other terms, I cannot specify them one by one, and I need to detect them with svn status and then automatically remove them. However the line doesn't work.

svn status | grep ^\! | awk '{print $2}' | xargs svn --force delete

如你所见,我已经替换了

As you can see I've replaced

"?" 与 "!" 和

"add" with "--force delete"

你能告诉我为什么它不起作用吗?

Could you tell me why it doesn't work ?

ps.我知道这是一个冒险的过程.我已经讨论过了.谢谢

ps. I know it is a risky procedure. I've already discussed all about it. thanks

谢谢

我刚试过这个,效果很好.

I just tried this and it works perfectly.

$ svn st | grep '^!' | awk '{print $2}' | xargs svn delete --force
D         groups.pl
D         textblock.pl

您的文件名称中有空格吗?

Do your files have spaces in their names?

等一下!!我看到了问题所在.你有:

WAIT A SECOND!! I see the problem. You have:

svn --force delete

而不是:

svn delete --force

--forcedelete 命令的参数,而不是 svn 命令的参数.

The --force is a parameter of the delete command and not the svn command.