我可以在 perforce 中安全地编辑重命名的文件吗 [英] Can I safely edit a renamed file in perforce

查看:48
本文介绍了我可以在 perforce 中安全地编辑重命名的文件吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件需要移动,该文件已经强制执行.一旦移动,它需要一些编辑 - 更新包等 - 适合其新位置.我应该提交移动更改规范,然后重新打开以进行编辑,还是可以一次性完成?如果是这样,适当的事件顺序是什么?

I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, what is the appropriate sequence of events?

推荐答案

我以前一次性完成过,但根据您的构建过程,我建议不要这样做.我通常做的是这样的:

I have done this before in one go, but depending on your build process, I recommend against it. What I generally do is this:

  1. 移动文件.
  2. 如果移动需要更改才能编译,请打开它进行编辑并进行这些更改.
  3. 提交更改,告诉 perforce 重新打开文件进行编辑.
  4. 对路径等进行更改,这些更改不会导致编译错误但应该更新.
  5. 提交带有适当说明的更改.

但是,如果您愿意,可以在上面的步骤 (2) 中进行所有更改.Perforce 可能会将新文件的标志从集成更改为添加,但它仍会记住文件的源路径.

If you want to, however, you could just do all your changes in step (2) above. Perforce might change the flag for the new file from integrate to add, but it still remembers the source path for the file.

更好的方法

我意识到我经常使用不同的方法,但是移动"文件的想法让我分心.所以,我会推荐以下步骤:

I realized that I often use a different method, but the idea of "moving" the file distracted me. So, I would recommend these steps instead:

  1. 将文件整合到新的路径/名称中,将之前的文件留在那里.我假设这不会破坏您的构建过程.
  2. 提交新文件,提交后再次检查以进行编辑.
  3. 对新文件和项目进行必要的更改,以便您使用新文件.
  4. 提交对新文件的编辑.
  5. [可选] 您可能需要检查分支规范,看看是否需要将旧文件映射到任何分支中的新文件.
  6. 创建用于删除旧文件的更改列表,稍后再提交.

此方法允许将编辑与重命名/移动完全分开,同时永远不会使项目处于无法编译的状态.

This method allows the edits to be cleanly separated from the rename/move, while never leaving the project in a state that won't compile.

另外,为什么要等待第 6 步?有时,尤其是在较大的项目中,您可能想要移动其他人正在编辑的文件.Perforce 会很有帮助地告诉你这一点.通过等待删除文件,您允许您的同事完成编辑并提交,而无需手动移动他们的工作.编辑提交后,可以将它们整合到新文件中,然后可以安全地删除旧文件.

Also, why wait for step 6? Sometimes, especially on bigger projects, you might want to move a file that another person is editing. Perforce will helpfully tell you this. By waiting to delete the file, you allow your coworker(s) to finish the edits and submit without needing to move their work manually. After the edits are submitted, they can be integrated into the new file, and then the old one can be safely deleted.

这篇关于我可以在 perforce 中安全地编辑重命名的文件吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆