从 CVS 中删除空目录?

发布于 2024-07-08 09:37:03 字数 1208 浏览 9 评论 0原文

我不太确定这是如何发生的,但不知何故,我的存储库中最终出现了一个完全空的目录层次结构:

com/
com/companyname/
com/companyname/blah/
com/sun/
com/sun/java/
com/sun/java/jax_rpc_ri/

我认为发生的情况是这些目录中确实有文件,但后来开发人员意识到他/她不应该首先检查了它们,因为这些是构建过程的副产品,所以他/她删除了这些文件,但不知何故,空目录作为古代遗迹留在存储库中。

我怎样才能从 CVS 中删除它? 我似乎能够在谷歌上找到的唯一结果是,不需要删除空目录,因为 CVS 不会首先保留它们,并且 -P cvs update 的(修剪)选项应该将它们从工作目录中删除 - 如果您的存储库中实际上有空目录,那么这就是零帮助。

cvs removecvs 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

梦冥 2024-07-15 09:37:03

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

You don't remove the directory itself;
there is no way to do that.

岁月蹉跎了容颜 2024-07-15 09:37:03

CVS 签出和更新将始终签出空目录; 这就是 CVS 的构建方式。 使用“-P”(“prune”)进行更新以删除空目录:(

cvs update -dP

添加“-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:

cvs update -dP

(Adding "-d" will update new directories that have appeared since your last update; otherwise, CVS will ignore them.)

红玫瑰 2024-07-15 09:37:03

刚刚做了

  1. rm -rvf /localCopy/project/emptyDirectory
  2. 编辑 /localCopy/project/CVS/Entries,删除行 D/emptyDirectory////,保存文件
  3. rmdir -v /CVSROOT/project/emptyDirectory

以删除项目中的emptyDirectory。 承认乱搞内部 CVS 数据是不合法的,但似乎有效(cvs 版本 1.12.13)。

Just did

  1. rm -rvf /localCopy/project/emptyDirectory
  2. edit /localCopy/project/CVS/Entries, delete line D/emptyDirectory////, save file
  3. rmdir -v /CVSROOT/project/emptyDirectory

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).

快乐很简单 2024-07-15 09:37:03

CVS 有许多设计缺陷,其中之一就是永远无法在不丢失历史记录的情况下删除目录。 另一个困难是在不丢失历史记录的情况下重命名文件和目录。

考虑升级到 Subversioncvs2svn 在转换存储库(包括所有分支和标签)方面做得非常好。 CVS 和 SVN 命令集非常相似,只需要很少的调整。 (为了避免这成为一场“你应该使用什么版本控制”战争)一旦你使用了 SVN,你就可以迁移到任意数量的更高级的版本控制系统,例如 gitSVK

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.

淡淡の花香 2024-07-15 09:37:03

这对我有用。 基本上,当您执行

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.

神也荒唐 2024-07-15 09:37:03

cvs 倾向于采用有关目录的两阶段方法,这就是为什么许多 cvs 命令都有一个 -P 选项来“修剪空目录”。

当发生这种情况时,例如想要重命名我刚刚添加的目录,我删除该目录,删除 CVS/Entries 文件中该目录的条目,它将是一个前面带有“D”的行。

任务完成。

如果我已经承诺,我会确保包含空目录的当前工作区域全部签入。然后我吹走已添加目录的工作区域部分。

例如,

~/Sandbox/my_project/some_stuff_i_want
~/Sandbox/my_project/empty_dir_1
~/Sandbox/my_project/other_stuff_i_want

我确保包含我想要保留的内容的两个目录中的所有内容都是最新的。 然后我从沙箱中吹走 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

~/Sandbox/my_project/some_stuff_i_want
~/Sandbox/my_project/empty_dir_1
~/Sandbox/my_project/other_stuff_i_want

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

淡笑忘祈一世凡恋 2024-07-15 09:37:03

您无法从工作区中删除目录,您需要将其从保存实际存储库的服务器中删除。 但您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文