迁移到SVN,对删除旧文件感到困惑 [英] Migration to SVN, confused about deleting old files

查看:160
本文介绍了迁移到SVN,对删除旧文件感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个StarTeam存储库,我正尝试迁移到SVN.不幸的是,仓库是巨大的,所以我不能使用任何Polarion脚本等.我要检出StarTeam中每个版本的快照,然后手动将它们添加/提交到SVN.

但是,我对如何处理旧文件感到困惑.在StarTeam中,由于清除命令删除了该文件的所有副本,因此我们不得不将已删除的文件移动到过时"的文件夹中.我知道我不需要在SVN中执行此操作,但是SVN如何处理已删除/丢失的文件?

说我有以下结构的三个文件:

trunk/
    Src/
        A.cpp
        B.cpp
        C.cpp

如果从一个发行版到另一个发行版中,我删除了"C.cpp",我是否只需要提交所有src才能将删除内容反映到SVN存储库中?

同样,如果我删除了"C.cpp"但添加了"D.cpp",则在提交之前,我需要在所有"src/"上调用add.这样会在检测和删除丢失的文件时引起任何问题吗?它们太多,无法手动进行,并逐个删除.

作为一个单独的问题,是否有原因导致tortoiseSVN需要大约3个小时才能检测到哪些文件已更改,然后才能添加/提交?我所看到的只是对话框中的请稍候..."消息,而且需要花费很多时间.

谢谢!

解决方案

您对存储库所做的任何更改都需要提交,因此在执行svn delete之后,您需要svn commit.同样,在添加文件时,需要进行更改.在这两种情况下,都可以撤消添加和删除操作而无需提交.

在一次交易中添加和删除文件(同样有效)方面,您可以有效地发出:

svn delete C.cpp
svn add D.cpp
svn commit

如果要恢复已删除的文件,则可以从svn存储库的早期版本恢复文件,然后重新提交(另请参见 missing "而不是" deleted ",并且提交回购将不会提交删除;因此,下次更新工作副本时,丢失的文件将被还原.因此,您可以使用subversion删除文件,以便subversion知道您确实希望将其删除.

最后一个问题-SVN的版本是多少,回购协议有多少(按文件计数).本质上,T-SVN必须走树并对照回购版本检查每个文件,以查看其已更改.从SVN 1.7开始,工作副本格式发生了变化,数据库中保存了许多元数据,并且对原始副本的存储(即,文件从svn出来时的外观进行了改进)的改进意味着它比它快曾是.如果您没有使用1.7,那么值得一试.另外,如果您有一个大型仓库,但只使用其中的一小部分,则可以考虑使用稀疏签出来减小本地工作副本的大小.有关简短概述或稀疏检出,请参见从Subversion检出一个文件的此答案.

I have a StarTeam repo that I'm trying to migrate to SVN. Unfortunately the repo is HUGE, so I can't use any of the polarion scripts, etc. I'm resorting to checking out snapshots of each release in StarTeam and then manually adding/committing them to SVN.

However, I'm confused about what to do for old files. In StarTeam, we had to move deleted files to an "obsolete" folder since the purge command removed all copies of the file. I know that I don't need to do that in SVN, but how does SVN deal with files which have been deleted/are missing?

Say I have three files in the following structure:

trunk/
    Src/
        A.cpp
        B.cpp
        C.cpp

If from one release to another I deleted "C.cpp", do I just need to commit all of src for the deletion to be reflected in the SVN repo?

Likewise, if I deleteed "C.cpp" but added "D.cpp", I would need to call add on all of "src/" before committing. Would that cause any problems with detecting and deleting the missing files? There are too many of them to go through manually and delete every one individually.

As a separate question, is there a reason why it takes tortoiseSVN almost 3 hours to detect which files are changed before I can add/commit? All I see is the "Please wait..." message in the dialog box, and it takes FOREVER.

Thanks!

解决方案

Any change you make to the repo needs a commit, so yes after doing svn delete you need to svn commit. Similarly when you add files, that's a change that needs to be committed. In both cases it's possible to undo the add and delete without commiting.

In terms of adding and removing files in one transaction, again that "just works", you'd effectively issue:

svn delete C.cpp
svn add D.cpp
svn commit

If you want to recover a deleted file, then you can just recover the file from an earlier revision of the svn repo, then recommit (see also What is the correct way to restore a deleted file from SVN?).

The main thing you must remember though when deleting files: you must delete it using subversion tools (i.e. from the command line as svn delete or using Delete within TortoiseSVN. Just deleting it using del, rm, or a file manager like windows explorer will have SVN see the file as "missing" and not "deleted", and a commit of the repo will not commit the delete; thus the next time you update your working copy, the missing files will be restored. Thus you use subversion to delete the file so subversion knows that you do actually want it deleted.

For your last question -- what version of SVN and how big is the repo (in terms of file-count). Essentially T-SVN has to walk the tree and check each file against the repo-version to see it it's changed. As of SVN 1.7, the working copy format changed with a lot of metadata being held in the database, and improvements to the storage of pristine copies (i.e., what the file looked like when it came out of svn) means that it's faster than it was. If you aren't using 1.7, then it's worth checking out. Also, if you have a large repo but only work in a small part of it then consider using sparse checkouts to reduce the size of your local working copy. See this answer to Checkout one file from Subversion for a brief overview or sparse checkouts.

这篇关于迁移到SVN,对删除旧文件感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆