一份拷贝代码用于新的项目,难免会提交些无用文件(通常为开发非release版本)。而这些开发版本可能会泄漏系统信息,所以会有需求:将其从svn中删除。
但如不当使用svn delete可能导致代码无法恢复并重写(这是个真实的故事)。
所以有了如下的尝试:
[luwenwei@appdev1 thunder_bbs]$ svn delete test.php D test.php [luwenwei@appdev1 thunder_bbs]$ svn st test.php D test.php [luwenwei@appdev1 thunder_bbs]$ ls test.php ls: test.php: 没有那个文件或目录 [luwenwei@appdev1 thunder_bbs]$ svn ci test.php -m 'Del file:test.php' 删除 test.php 提交后的修订版为 30。 [luwenwei@appdev1 thunder_bbs]$ ls test.php ls: test.php: 没有那个文件或目录 [luwenwei@appdev1 thunder_bbs]$ ./tools/deploy.minor.release.sh test.php test.html === export chunk from svn === /usr/bin/find: /home/luwenwei/deploy/thunder_bbs/test.php: 没有那个文件或目录 /usr/bin/find: /home/luwenwei/deploy/thunder_bbs/test.html: 没有那个文件或目录 没有找到要上传的文件,请调整输入参数
从中能够看到:svn delete test.php操作完成后,本地文件就被删除了。
这个时候:如果没有提交到svn服务器上时,还可以通过svn up来恢复代码;如果提交了svn,那么项目修改版本会加1(提交前为29版本,提交后为30)。