递归 CVS 添加文件/目录并忽略现有 CVS 文件
有一个类似的帖子@ 如何递归添加 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能更优雅一点:
请注意,print0 虽然对于处理包含空格的文件名非常有用,但它不是通用的 - 例如,它不是在 Solaris 的 find 中。
This may be a bit more elegant:
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.
请参阅我的这个答案对引用问题的解释为什么您收到“无法打开 CVS/条目进行读取”错误。
查看此处提供的其他解决方案时要记住两件重要的事情:
,如果您刚刚开始填充存储库,并且尚未检查任何可以为添加的文件创建上下文的内容,则无法使用
cvs add
- 或者至少不是直接的。您可以通过在要添加的第一个文件夹的父文件夹中调用以下命令来创建“根上下文”:这将创建必要的沙箱元数据(即隐藏的“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:
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: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.