使用 Perforce 创建构建?

发布于 2024-08-20 10:21:34 字数 238 浏览 9 评论 0 原文

为项目创建部分构建时,我通常将项目文件夹最新版本与生产标签进行比较。然后我必须手动将所有更改/添加的文件添加到临时文件夹中,然后再将其复制到生产环境中。

有没有办法自动执行此操作?

例如,如果我们需要更新客户网站,我们只想发送已更改的文件。目前,为了确定他们当前的生产网站与我们在源代码控制中的内容之间的差异,我们对网站文件夹上的两个不同标签进行了比较。然后我们创建一个仅包含已更改文件的构建。

When creating partial builds for a project, I usually diff the project folder latest revision against a production label. Then I have to manually add all the changed/added files to a temporary folder before copying it to production.

Is there a way to automate this?

For example, if we need to update a client website, we only want to send the files that have changed. Currently, to determine the difference between their current production website and what we have in source control, we diff against two different labels on the website folder. Then we create a build with only the files that have changed.

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

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

发布评论

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

评论(5

温柔戏命师 2024-08-27 10:21:34

@Kevin

您可以通过执行以下操作(*nix版本)来跳过“p4同步//depot/folder...@labelv2”的解析:

p4 sync //depot/folder...@labelv1

# delete all files on client - but don't tell perforce about it
rm -r <root of your client> 

p4 sync //depot/folder...@labelv2

现在客户端应该只有在labelv1和labelv2之间更改的文件。您只需将所有文件从客户端复制到您的部署位置即可。下面的命令为您提供文件列表:

find <root of your client> -type f

@Kevin

You can probably skip the parsing of "p4 sync //depot/folder...@labelv2" by doing the following (*nix version):

p4 sync //depot/folder...@labelv1

# delete all files on client - but don't tell perforce about it
rm -r <root of your client> 

p4 sync //depot/folder...@labelv2

Now the client should only have the files that changed between labelv1 and labelv2. You can just copy all files from the client to your deployment location. The command below gives you a list of files:

find <root of your client> -type f
再见回来 2024-08-27 10:21:34

您使用术语“创建构建”。听起来这意味着“用 Perforce 中已更改的内容创建一个文件,以便我们可以在其他地方进行更新”。

假设您想要一个 Perforce 客户端,其中包含您想要在生产环境中使用的文件,然后使用 rsync 等工具将它们移动到 Web 服务器。您的脚本基本上包含“p4sync && rsync 这里那里”。 Rsync 将经历找出不同之处并移动更改的过程。

如果情况并非如此,您需要更准确地表达您的意思。

You use the term "create a build". It sounds like that means "create a file with the things that have changed in Perforce so that we can update somewhere else".

Assuming that, you want to have a Perforce client that contains the files you want to have in production, and then use a tool like rsync to move them to the webserver. Your script basically contains "p4 sync && rsync here there". Rsync will go through the process of figuring out what is different and moving the changes.

If that isn't the case, you need to be more precise about what you mean.

新雨望断虹 2024-08-27 10:21:34

我不确定我是否正确理解您想要执行的操作,但是比较文件夹然后手动添加更改/添加的文件听起来确实像集成(或合并,在其他版本控制系统的俚语中)。

命令行上的 p4 helpintegra 也会有帮助(也许)这篇 Perforce 知识库文章

I'm not sure if I understand correctly what you are trying to do, but diffing folder and then manually adding changed/added files sure sounds like integrating (or merging, in other versioning systems' slang).

p4 help integrate on the command line will help as well as (maybe) this Perforce KB article.

穿透光 2024-08-27 10:21:34

使用可下载的脚本 API 之一来自动化该过程。

您选择哪一种很大程度上取决于个人品味,但如果您对任何受支持的语言都不是特别熟悉,我建议您使用 Ruby API。

Use one of the scripting APIs available for download to automate the process.

Which one you pick is largely a matter of personal taste, but if you're not especially familiar with any of the supported languages already I'd suggest the Ruby API.

小耗子 2024-08-27 10:21:34

如果您将构建产品存储在仓库中,那么我想您应该执行以下操作(来自精美的书“Practical Perforce”):

找到已更改的文件并打开它们进行编辑:

p4 diff -se | p4 -x- 编辑

找到被删除的文件并打开它们进行删除:

p4 diff -sd | p4 -x- 删​​除

查找新文件并打开它们进行添加。假设您位于工作区的顶级目录中:

找到 . -类型 f | p4 -x- 添加 -f

完成此操作后,您可以提交待处理的更改列表或继续处理打开的文件。

如果您需要更多解释,请联系我。

If you store build products in depot, then I guess you should do the following (from beautiful book "Practical Perforce"):

Find the files that were changed and open them for editing:

p4 diff -se | p4 -x- edit

Find the files that were removed and open them for deleting:

p4 diff -sd | p4 -x- delete

Find the files that are new and open them for adding. Assuming that you're in the top-level directory of your workspace:

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

Having done this, you can either submit your pending changelist or continue working on your opened files.

Please ping me if you need additional explanations.

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