使用perforce捕获外部目录的当前状态

发布于 2024-09-16 17:46:50 字数 284 浏览 3 评论 0 原文

我在存储库之外有一个目录。我把生成的源放在那里。这些生成的源需要很长时间才能创建。我不想让团队中的每个人都生成这些源代码,而是想使用我们的构建机器来生成源代码,并将它们签入到 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).

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

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

发布评论

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

评论(4

橘味果▽酱 2024-09-23 17:46:50

按照您的建议开始 - p4 edit 和 p4 add 捕获所有更改,然后调用

p4 revert -a

Which 将恢复仓库中打开进行编辑但实际上未更改或丢失的任何文件。

Start as you suggested - p4 edit and p4 add to capture all changes, then call

p4 revert -a

Which will revert any file in the depot that is open for edit but is actually unchanged or missing.

久而酒知 2024-09-23 17:46:50

我在 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

不语却知心 2024-09-23 17:46:50

一种想法是,在构建之前,手动删除该区域中的所有内容(不是通过 Perforce,而是通过操作系统)。完成构建后,执行“协调离线工作”。这将通过添加新文件、删除不再存在的文件以及编辑已更改的文件来协调 Perforce 中该区域中的内容。

您可以通过 P4V 协调离线工作,如此处所示。 在工作区浏览器中,右键单击该文件夹并选择“协调离线工作”。

或者,如果您更喜欢更自动化的解决方案,则可以通过命令行来完成此操作,如 此处。(注意:此链接还讨论了通过 p4v 进行协调,但这已被上一个链接取代)

p4 diff -se //myclient/... | p4 -x - edit

以签出更改的文件。

p4 diff -sd //myclient/... | p4 -x - delete

删除文件。

find . -type f -print | p4 -x - add
find . -type l -print | p4 -x - add

在 Unix 中添加文件和符号链接,或

dir /s /b /a-d | p4 -x - add

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

p4 diff -se //myclient/... | p4 -x - edit

to checkout changed files.

p4 diff -sd //myclient/... | p4 -x - delete

to delete files.

find . -type f -print | p4 -x - add
find . -type l -print | p4 -x - add

to add files and symlinks in Unix, or

dir /s /b /a-d | p4 -x - add

to add files in Windows.

薄荷港 2024-09-23 17:46:50

对于 Perforce 中的二进制文件,您可以设置一个 FileType 标志,该标志仅存储存储库中文件的 1 个(或一组)修订版本。这样,您将拥有该文件的历史记录,但您的其他用户只能访问该文件最新版本的二进制文件,并且您的服务器将仅存储一个副本,如果您不需要存储多个副本,则存储效率更高。

为了做出改变。

  1. 将您感兴趣的文件添加到存储库中。
  2. 查看文件。
  3. 在P4V中右键单击并选择更改文件类型
  4. 在弹出的对话框中选择屏幕底部的+S“服务器限制存储的修订数量”,这将限制存储的文件数量。

希望这有帮助。

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.

  1. Add the files you are interested in to the repository.
  2. Check out the file.
  3. Right click in P4V and select Change Filetype
  4. On the dialog pops up select +S "Server limits the number of revisions stored" at the bottom of the screen, which will restrict the number of files stored.

Hope this helps.

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