从 CVS 中删除空目录?
我不太确定这是如何发生的,但不知何故,我的存储库中最终出现了一个完全空的目录层次结构:
com/
com/companyname/
com/companyname/blah/
com/sun/
com/sun/java/
com/sun/java/jax_rpc_ri/
我认为发生的情况是这些目录中确实有文件,但后来开发人员意识到他/她不应该首先检查了它们,因为这些是构建过程的副产品,所以他/她删除了这些文件,但不知何故,空目录作为古代遗迹留在存储库中。
我怎样才能从 CVS 中删除它? 我似乎能够在谷歌上找到的唯一结果是,不需要删除空目录,因为 CVS 不会首先保留它们,并且 -P
cvs update
的(修剪)选项应该将它们从工作目录中删除 - 如果您的存储库中实际上有空目录,那么这就是零帮助。
cvs remove
和 cvs commit
似乎没有处理这种情况:
$ cvs remove -Rf com
cvs remove: Removing com
cvs remove: Removing com/companyname
cvs remove: Removing com/companyname/blah
cvs remove: Removing com/sun
cvs remove: Removing com/sun/java
cvs remove: Removing com/sun/java/jax_rpc_ri
$ cvs commit com
cvs commit: Examining com
cvs commit: Examining com/companyname
cvs commit: Examining com/companyname/blah
cvs commit: Examining com/sun
cvs commit: Examining com/sun/java
cvs commit: Examining com/sun/java/jax_rpc_ri
$ ls -l com
total 24
drwxrwxr-x 2 matt matt 4096 Oct 15 14:38 CVS
drwxrwxr-x 9 matt matt 4096 Oct 15 14:38 companyname
drwxrwxr-x 4 matt matt 4096 Oct 15 14:38 sun
它仍然存在!
SVN 也有这种奇怪的行为吗?
I'm not quite sure how this happened, but somehow a completely empty hierarchy of directories has ended up in my repository:
com/
com/companyname/
com/companyname/blah/
com/sun/
com/sun/java/
com/sun/java/jax_rpc_ri/
I think what happened was that these directories did have files in them, but then a developer realized he/she shouldn't have checked them in in the first place since these are by-products of the build process, so he/she removed the files but somehow the empty directories are left in the repository as ancient relics.
How can I remove this from CVS? The only results I seem to be able to find on google say that there shouldn't be a need to remove empty directories as CVS won't keep them around in the first place, and that the -P
(prune) options to cvs update
should remove them from the working directory - which is zero help if you actually have empty directories in your repository.
A cvs remove
and cvs commit
doesn't seem to take care of this situation:
$ cvs remove -Rf com
cvs remove: Removing com
cvs remove: Removing com/companyname
cvs remove: Removing com/companyname/blah
cvs remove: Removing com/sun
cvs remove: Removing com/sun/java
cvs remove: Removing com/sun/java/jax_rpc_ri
$ cvs commit com
cvs commit: Examining com
cvs commit: Examining com/companyname
cvs commit: Examining com/companyname/blah
cvs commit: Examining com/sun
cvs commit: Examining com/sun/java
cvs commit: Examining com/sun/java/jax_rpc_ri
$ ls -l com
total 24
drwxrwxr-x 2 matt matt 4096 Oct 15 14:38 CVS
drwxrwxr-x 9 matt matt 4096 Oct 15 14:38 companyname
drwxrwxr-x 4 matt matt 4096 Oct 15 14:38 sun
It's still there!
Does SVN have this weird behavior too?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
AFAIK CVS 协议不允许删除目录。 您应该转到服务器控制台并将它们从真实的物理存储库中删除。
http://www.network-theory.co.uk/docs/cvsmanual /删除目录.html
AFAIK the CVS protocol does not allow to remove directories. You should go to the server console and remove them from the real physical repository.
http://www.network-theory.co.uk/docs/cvsmanual/Removingdirectories.html
CVS 签出和更新将始终签出空目录; 这就是 CVS 的构建方式。 使用“-P”(“prune”)进行更新以删除空目录:(
添加“-d”将更新自上次更新以来出现的新目录;否则,CVS 将忽略它们。)
CVS checkout and update will always check out empty directories; that's just the way CVS is built. Do an update with "-P" -- "prune" -- to remove empty directories:
(Adding "-d" will update new directories that have appeared since your last update; otherwise, CVS will ignore them.)
刚刚做了
以删除项目中的emptyDirectory。 承认乱搞内部 CVS 数据是不合法的,但似乎有效(cvs 版本 1.12.13)。
Just did
to get rid of emptyDirectory in project. Admit not legit to mess with internal CVS data, but seems to have worked (cvs version 1.12.13).
CVS 有许多设计缺陷,其中之一就是永远无法在不丢失历史记录的情况下删除目录。 另一个困难是在不丢失历史记录的情况下重命名文件和目录。
考虑升级到 Subversion。 cvs2svn 在转换存储库(包括所有分支和标签)方面做得非常好。 CVS 和 SVN 命令集非常相似,只需要很少的调整。 (为了避免这成为一场“你应该使用什么版本控制”战争)一旦你使用了 SVN,你就可以迁移到任意数量的更高级的版本控制系统,例如 git 或 SVK。
CVS has a number of design flaws, never being able to get rid of a directory without losing history is one. Difficulty renaming files and directories without losing history is another.
Consider graduating to Subversion. cvs2svn does a very good job converting repositories including all branches and tags. The CVS and SVN command sets are very similar and require minimal adjustment. (And to head off this becoming a "what version control should you use" war) once you're using SVN you can move to any number of more advanced version control systems such as git or SVK.
这对我有用。 基本上,当您执行
rmdir -v /CVSROOT/project/emptyDirectory # 我们正在从 CVS 存储库目录中删除目录。
如果您有存储库 unix 服务器登录访问权限,您可以前往该路径并删除该目录,或者向 unix 团队提出同样的问题。
This worked for me. Basically When you do
rmdir -v /CVSROOT/project/emptyDirectory # We are deleting directory from CVS repository directory.
If you have repository unix server login access, you can travel to the path and can delete the directory,or raise the same concern with unix team.
cvs 倾向于采用有关目录的两阶段方法,这就是为什么许多 cvs 命令都有一个 -P 选项来“修剪空目录”。
当发生这种情况时,例如想要重命名我刚刚添加的目录,我删除该目录,删除 CVS/Entries 文件中该目录的条目,它将是一个前面带有“D”的行。
任务完成。
如果我已经承诺,我会确保包含空目录的当前工作区域全部签入。然后我吹走已添加目录的工作区域部分。
例如,
我确保包含我想要保留的内容的两个目录中的所有内容都是最新的。 然后我从沙箱中吹走 my_project。
然后我从存储库本身删除空目录。
返回并检查相同的工作区域,例如 my_project 将为我提供没有空目录的工作区域。
或者将所有内容保留原样并使用 -P 选项让 CVS 检查所有内容(或更新所有内容),然后删除空目录。
HTH
干杯,
罗布
cvs tends to work on a two phase approach regarding directories that's why there is a -P option for many cvs commands to "Prune empty directories".
When this has happened, e.g. want to rename a directory I've just added, I delete the directory, delete the entry for the directory in the CVS/Entries file, it'll be a line prepended with a "D".
Job done.
If I've committed, I make sure my current working area that contains the empty directory/ies is all checked in. Then I blow away the part of the work area that I have added the directories to.
For example, in
I make sure everything is up to date in both directories containing the stuff I want to keep. I then blow away my_project from within my sandbox.
Then I delete the empty directories from the repository itself.
Going back and checking out the same work area, e.g. my_project will give me the work area without the empty dirs.
Or just leave everything as is and use the -P option to get CVS check everything out (or update everything), then prune out the empty dirs.
HTH
cheers,
Rob
您无法从工作区中删除目录,您需要将其从保存实际存储库的服务器中删除。 但您可以使用 cvs remove 命令从目录中删除文件。
You cannot delete directory from your workspace , you need to delete it from going to server where actual repository is kept. but you can delete files from the directory with cvs remove command.