我在存储库之外有一个目录。我把生成的源放在那里。这些生成的源需要很长时间才能创建。我不想让团队中的每个人都生成这些源代码,而是想使用我们的构建机器来生成源代码,并将它们签入到 perforce。如何执行此操作并确保源代码控制目录仅包含最新的文件,而不包含之前生成但不在最新版本中的任何文件?
我正在考虑对生成的目录中的所有文件(对于现有文件)进行 p4 edit
,然后使用通配符进行 p4 add
来获取任何新文件,但我不知道如何处理以前生成的文件,但在最近的构建中未生成(应删除)。
I have a directory outside the repository. I put generated sources in there. These generated sources take FOREVER to create. Rather than have everyone on the team generate these sources, I would like to use our build machine to generate the sources, and check them in to perforce. How do I do this and ensure that the source controlled directory only has only the most recent files and not any that were generated previously but not in the most recent build?
I was thinking of doing a p4 edit
on all the files in the generated directory (for existing files), then doing a p4 add
using wildcards to get any files that are new, but I do not know how to handle files that were previously generated, but not generated in the most recent build (should be deleted).
发布评论
评论(4)
按照您的建议开始 - p4 edit 和 p4 add 捕获所有更改,然后调用
Which 将恢复仓库中打开进行编辑但实际上未更改或丢失的任何文件。
Start as you suggested - p4 edit and p4 add to capture all changes, then call
Which will revert any file in the depot that is open for edit but is actually unchanged or missing.
我在 perforce 博客上找到了这个,这正是我正在寻找的。 使用 P4Java 和 Apache Ant 自动替换文件夹
I found this on the perforce blog and it is exactly what I was looking for. Automating folder replacement using P4Java and Apache Ant
一种想法是,在构建之前,手动删除该区域中的所有内容(不是通过 Perforce,而是通过操作系统)。完成构建后,执行“协调离线工作”。这将通过添加新文件、删除不再存在的文件以及编辑已更改的文件来协调 Perforce 中该区域中的内容。
您可以通过 P4V 协调离线工作,如此处所示。 在工作区浏览器中,右键单击该文件夹并选择“协调离线工作”。
或者,如果您更喜欢更自动化的解决方案,则可以通过命令行来完成此操作,如 此处。(注意:此链接还讨论了通过 p4v 进行协调,但这已被上一个链接取代)
以签出更改的文件。
删除文件。
在 Unix 中添加文件和符号链接,或
在 Windows 中添加文件。
One idea is to, before the build, removing everything in this area manually (not through Perforce, but through the OS). After doing the build, do a "Reconcile Offline Work". This will reconcile in Perforce what you have in this area by adding new files, deleting ones that are not there anymore, and editing those that have changed.
You can reconcile offline work through P4V, as seen here. In your workspace browser, right-click the folder and choose "Reconcile Offline Work".
Or, you can do it through the command line if you prefer a more automated solution, as seen here. (Note: this link also talks about reconciling through p4v, but this is superseded by the previous link)
to checkout changed files.
to delete files.
to add files and symlinks in Unix, or
to add files in Windows.
对于 Perforce 中的二进制文件,您可以设置一个 FileType 标志,该标志仅存储存储库中文件的 1 个(或一组)修订版本。这样,您将拥有该文件的历史记录,但您的其他用户只能访问该文件最新版本的二进制文件,并且您的服务器将仅存储一个副本,如果您不需要存储多个副本,则存储效率更高。
为了做出改变。
希望这有帮助。
For Binary files in Perforce you can set a FileType flag that only stores 1 (or a set number ) of revisions for the file in the repository. This way you will have history of the file but your other users will only have access to the binary for the latest version of the file and also your server will only store one copy which is much more storage efficient if you dont need to store multiple copies.
To make the change.
Hope this helps.