如何根据 subversion 删除文件?
我有一个名为“y”的文件夹,该文件夹未保存在版本控制中。我有一个受版本控制的文件夹“x”。我想将 y
复制到 x
中,因为这样我就可以在文件夹 上使用
Tortoisesvn
Check for Modifications
命令>x
然后我可以假设每个读取 Non-versioned
或 Ignored
的文件/文件夹都可以安全地删除。因为我的卫生间在没有它们的情况下已经正常工作了一年。
如何获取由 Subversion 标记为已添加以创建批处理脚本的文件列表?
更新。
我已经走了很远,我想我只需要一种自动化的方法。
我将 y 复制到 x 中。我运行检查修改。我可以右键单击对话框并将路径复制到剪贴板。我只选择未版本控制或忽略的文件。
我将路径粘贴到批处理文件中。我使用一些查找和替换魔法来创建这个。
XCOPY www.root\* www.root.backup /I /Q /R /S /E
CD www.root
DEL "Appraisals\*.*" /q /s
DEL "jobs\Backup\*.*" /q /s
DEL "New\Portability\BACKUP\*.*" /q /s
DEL "Footer\Codes\*.*" /q /s
DEL "QL\Commercial\*.*" /q /s
DEL "images\Discard\*.*" /q /s
DEL "Dup SH Pages\*.*" /q /s
DEL "ExtensionRequest\*.*" /q /s
DEL "ExtFile\*.*" /q /s
DEL "Ad\Include\*.*" /q /s
DEL "Bio\Include\*.*" /q /s
DEL "Contact\Include\*.*" /q /s
更新 #2
我更擅长使用类比和示例,所以这里是场景以及我想要的结果。
请想象我的仓库中有一个非常简单的主干。它只有一个文件 code.txt
我对该文件进行更改,然后将它们提交回存储库。将更改提交到存储库后,我仅将此文件从存储库导出到生产环境。
现在想象一下其他一些开发人员出现并且不与我交谈。他们将各种文件直接复制到生产服务器。
code.txt 的副本
bob 的 code.txt_backup 副本
bob 的 code.txt_backup.backup 副本的副本的副本
现在想象一下,我意识到了这一点,并决定在 subverion 中保护他们的代码。我将其添加到我的存储库并提交。现在,随着时间的推移,我意识到 bob 的 code.txt_backup.backup 副本的副本的副本的副本
实际上是生产的一部分,而其他两个文件是垃圾。
我从我的 WC 中删除了文件 code.txt 的副本
、bob 的 code.txt_backup 的副本
并提交。我还对 code.txt
进行了微小的更改。我承诺。
现在,当我与之前的修订版本进行比较并进行导出时,Tortoise 将导出更改的文件。
所以现在我有两个在生产中孤立的文件。我想要一个脚本将它们从生产中删除,因为它们不在 Subversion 的 HEAD 中。
现在想象一下,如果您有 5300 个文件和文件夹。 ....呼。
I have a folder named "y", that is not kept in version control. I have a folder "x" that is under version control. I want to copy y
into x
, because then I can use Tortoisesvn
Check for Modifications
command on folder x
I can then assume that every file/folder that reads Non-versioned
or Ignored
can safely be deleted. Since my WC has been working fine for a year without them.
How do I get a list of files marked by Subversion as added to create my batch script?
Update.
I've gotten pretty far, I think I just need a way to automate this.
I copied y into x. I ran check for modifications. I can right click the dialog and copy paths to clipboard. I only select the Unversioned or ignored files.
I paste the paths into a batch file. I use some find and replace magic to create this.
XCOPY www.root\* www.root.backup /I /Q /R /S /E
CD www.root
DEL "Appraisals\*.*" /q /s
DEL "jobs\Backup\*.*" /q /s
DEL "New\Portability\BACKUP\*.*" /q /s
DEL "Footer\Codes\*.*" /q /s
DEL "QL\Commercial\*.*" /q /s
DEL "images\Discard\*.*" /q /s
DEL "Dup SH Pages\*.*" /q /s
DEL "ExtensionRequest\*.*" /q /s
DEL "ExtFile\*.*" /q /s
DEL "Ad\Include\*.*" /q /s
DEL "Bio\Include\*.*" /q /s
DEL "Contact\Include\*.*" /q /s
Update #2
I work better with analogies and examples, so here is the scenario and what I want the outcome to be.
Please imagine I have the a very simple trunk in my repo. It has only one file code.txt
I make my changes to that file, commit them back to the repo. After changes are commited to the repo I export only this file from the repo to Production.
Now imagine some other developers come along and don't talk to me. They copy directly out to the production server all kinds of files.
copy of code.txt
bob's copy of code.txt_backup
copy of copy of copy of bob's copy of code.txt_backup.backup
Now Imagine, I realize this, and decide to protect their code in subverion. I add it to my repo and commit. Now over time I realize that copy of copy of copy of bob's copy of code.txt_backup.backup
is actually part of production and the other two files are garbage.
I delete the files copy of code.txt
,bob's copy of code.txt_backup
from my WC and commit. I also make a tiny change to code.txt
. I commit.
Now when I compare to previous revision and do an export Tortoise will export the changed file(s).
So Now I have two files orphaned on production. I want a script to delete them from production based on the fact that they are not in the HEAD of Subversion.
Now imagine if you had 5300 files and folders.
....Whew.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解您的问题,您只需将 y 的内容复制到签出的 x 中即可。
然后,使用 Windows 资源管理器打开 x。由于您的电脑上安装了 tortoise svn,因此未版本的文件将用蓝色图标标记,修改的文件将用红色图标标记,未修改的文件将用绿色图标标记。
这就是您要找的吗?
编辑
我只是有另一个想法:
最后Y将包含X中没有的文件,这就是你的想要,不?然后您可以将 Y 添加到 X 后从 X 中删除它们。
If I understand your issue correctly, you only need to copy the content of y into checked-out x.
Then, open x with windows explorer. Since you have tortoise svn installed on your PC, the files not under version will be flagged with a blue icon, those modified with a red icon and those not modified with a green icon.
Is that what you are looking for?
EDIT
I just had another idea:
In the end Y will contain the files not in X, which is what you want, no? Then you can delete them from X after adding Y to X.