高效同步大型 Perforce 存储库?

发布于 2025-01-03 06:32:26 字数 1459 浏览 1 评论 0原文

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

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

发布评论

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

评论(2

暖阳 2025-01-10 06:32:26

如果我了解您的情况:

  • 您正在处理一个非常大的项目。
  • 您拥有不完全最新的数据本地快照。
  • 您只想获取快照与服务器上最新快照之间的差异。

您应该遵循的步骤是:

  • 运行 p4sync -k 让 Perforce 认为您拥有所有文件的最新副本。
  • 运行 p4 diff -se ... | p4 -x -sync -f 强制同步任何过时的文件
  • 运行 p4 diff -sd ... | p4 -x -sync -f 强制同步任何丢失的文件

此时,您可能有从服务器中删除的本地文件。如果您关心这些,您可以编写一个简单的脚本来检测它们并将它们从文件系统中删除。

好消息是 Perforce 的下一个版本 (2012.1) 有一个 status 命令,可以更轻松地发现所有差异。

从另一个角度来看,您是否需要将整个项目放在您的工作空间中?您能否缩小工作区视图以仅处理数据的子集?

If I understand your situation:

  • You work against a very large project.
  • You have a local snapshot of the data that is not entirely up to date.
  • You wish to only obtain the differences between your snapshot and the latest on the server.

The steps you should follow are:

  • Run p4 sync -k to make Perforce think you have the latest copy of all files.
  • Run p4 diff -se ... | p4 -x - sync -f to force-sync any out of date files
  • Run p4 diff -sd ... | p4 -x - sync -f to force-sync any missing files

At that point you may have local files that were deleted from the server. If you care about those, you can write a simple script that detects them and removes them from your file system.

The good news is that Perforce's next release (2012.1) has a status command that will pick up all differences more easily.

To approach this from another angle, do you need the entire project in your workspace? Could you narrow your workspace view to only work with a subset of the data?

静若繁花 2025-01-10 06:32:26

这是一个经典的 Perforce 问题。

为了实现这一点,您需要将一些命令连接在一起。

p4 diff -sd //仓库/路径/... | p4 -x –sync -f

  1. p4 diff -sd 命令将查找工作空间中不存在的所有文件。
  2. p4 -x –sync -f 将强制同步这些文件。

正如 p4-randall 在他的 答案 中所说,您可能还想运行 p4 diff -se ... | p4 -x -sync -f 同步任何过期的文件。

哈特哈,

This is a classic Perforce question.

To achieve this you will need pipe a few commands together.

p4 diff -sd //Depot/Path/... | p4 -x – sync -f

  1. p4 diff -sd command will find all the files that do not exist in the workspace.
  2. p4 -x – sync -f will forcible sync these files.

As p4-randall has in his answer, you may also want to run p4 diff -se ... | p4 -x - sync -f to sync any files that are out-of-date.

HTH,

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