递归 CVS 添加文件/目录并忽略现有 CVS 文件

发布于 2024-08-05 16:28:34 字数 679 浏览 5 评论 0原文

有一个类似的帖子@ 如何递归添加 CVS 目录

但是,尝试一些的答案,例如:

find . -type f -print0| xargs -0 cvs add

给出:

cvs add:无法打开 CVS/条目 正在阅读:没有这样的文件或目录cvs [添加中止]:没有存储库

find . \! -name 'CVS' -and \! -name 'Entries' -and \! -name 'Repository' -and \! -name 'Root'  -print0| xargs -0 cvs add

给出:

cvs add: 无法添加特殊文件“.”; 跳过

有人有更彻底的解决方案来递归地将新文件添加到 CVS 模块?如果我也可以在 ~/.bashrc 或类似的东西中为它起别名,那就太好了。

是的,我确实知道它有点过时,但我被迫在某个项目中使用它,否则我会使用 git/hg。

There's a similar post @ How to add CVS directories recursively

However, trying out some of the answers such as:

find . -type f -print0| xargs -0 cvs add

Gave:

cvs add: cannot open CVS/Entries for
reading: No such file or directory cvs
[add aborted]: no repository

And

find . \! -name 'CVS' -and \! -name 'Entries' -and \! -name 'Repository' -and \! -name 'Root'  -print0| xargs -0 cvs add

Gave:

cvs add: cannot add special file `.';
skipping

Does anyone have a more thorough solution to recursively adding new files to a CVS module? It would be great if I could alias it too in ~/.bashrc or something along those lines.

And yes, I do know that it is a bit dated but I'm forced to work with it for a certain project otherwise I'd use git/hg.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

凝望流年 2024-08-12 16:28:34

这可能更优雅一点:

find . -type f -print0 | egrep -v '\/CVS\/|^\.

请注意,print0 虽然对于处理包含空格的文件名非常有用,但它不是通用的 - 例如,它不是在 Solaris 的 find 中。

| xargs -0 cvs add

请注意,print0 虽然对于处理包含空格的文件名非常有用,但它不是通用的 - 例如,它不是在 Solaris 的 find 中。

This may be a bit more elegant:

find . -type f -print0 | egrep -v '\/CVS\/|^\.

Please note that print0, while very useful for dealing with file names containing spaces, is NOT universal - it is not, for example, in Solaris's find.

| xargs -0 cvs add

Please note that print0, while very useful for dealing with file names containing spaces, is NOT universal - it is not, for example, in Solaris's find.

梦中的蝴蝶 2024-08-12 16:28:34
find . -name CVS -prune -o -type f -print0
find . -name CVS -prune -o -type f -print0
锦欢 2024-08-12 16:28:34

请参阅我的这个答案对引用问题的解释为什么您收到“无法打开 CVS/条目进行读取”错误。

查看此处提供的其他解决方案时要记住两件重要的事情:

  • 也必须添加文件夹
  • 才能添加文件或文件夹,该项目的父文件夹必须已添加,因此项目的顺序因此

,如果您刚刚开始填充存储库,并且尚未检查任何可以为添加的文件创建上下文的内容,则无法使用 cvs add - 或者至少不是直接的。您可以通过在要添加的第一个文件夹的父文件夹中调用以下命令来创建“根上下文”:

cvs co -l .

这将创建必要的沙箱元数据(即隐藏的“CVS”子文件夹)包含“Root”、“Repository”和“Entries.*”文件),这将允许您使用添加命令。

See this answer of mine to the quoted question for an explanation of why you get the "cannot open CVS/Entries for reading" error.

Two important things to keep in mind when looking at the other solutions offered here:

  • folders have to be added, too
  • in order to add a file or folder, the parent folder of that item must already have been added, so the order in which items are processed is very important

So, if you're just starting to populate your repository and you haven't yet got anything to check out that would create a context for the added files then cvs add cannot be used - or at least not directly. You can create the "root context" by calling the following command in the parent folder of the first folder you want to add:

cvs co -l .

This will create the necessary sandbox meta-data (i.e. a hidden "CVS" subfolder containing the "Root", "Repository" and "Entries.*" files) that will allow you to use the add command.

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