将 Visual Studio 与 Perforce 结合使用时重命名类的工作流 [英] Workflow for renaming a class when using Visual Studio with Perforce

查看:64
本文介绍了将 Visual Studio 与 Perforce 结合使用时重命名类的工作流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我是 perforce 的新手,并试图避免让自己陷入问题,我在使用其他源代码控制系统时遇到了问题)

(I am new to perforce and am trying to avoid getting myself into problems, I have hit problems doing this with other source code control systems)

当我重命名我的班级时,我需要

When I rename I class I need to

  • 更改自己的类名
  • 让 Visual Studio 重构所有使用该类的代码
  • 重命名 Visual Studio 项目中的文件
  • 在 Perforce 中重命名文件
  • 检查对 perforce 的更改
  • 然后也许可以将我的工作分支中的更改合并到主分支中

使用 perforce 执行上述操作的最佳方法是什么?我需要注意哪些问题?

What’s the best way to do the above with perforce? What issues to I need to be aware of?

推荐答案

不幸的是,这是一个多步骤的过程.您需要先使用 resharper 移动它,然后使用 perforce 再次移动它.

This is a multi-step process unfortunately. What you need to do move it first using resharper and then move it again using perforce.

这就是我的做法(在 Perforce 9.2 及更高版本中):

This is how I do it (in Perforce 9.2 and above):

  1. 首先,在 Perforce 中签出文件.这将清除这些文件的只读标志,并让 Resharper 在移动过程中修改这些文件.
  2. 使用 Resharper 的 Move 重构并将类移动到新目录.
  3. 上一步还将文件从旧文件夹移动到新文件夹.所以现在我们必须解决这个问题,以便我们也可以在 Perforce 中进行移动操作.使用 Windows 资源管理器(或任何您喜欢的工具)将文件从位置移回位置.
  4. 转到 Perforce 并使用重命名/移动上下文菜单移动文件.这将为每个文件在更改列表中创建一对条目;第一个条目用于从原始文件夹中删除文件,第二个条目用于将其添加到新文件夹中.
  1. First, checkout the files in Perforce. This will clear the readonly flags for those files and let Resharper modify the files as part of the move.
  2. Use Resharper's Move refactoring and move the classes to the new directory.
  3. The previous step also moved the files from the old folder to the new folder. So now we have to fix that so we can do also do the move operation in Perforce. Use Windows Explorer (or whatever is your favorite tool) to move the files from the new location back to the old location.
  4. Go to Perforce and using the Rename/Move context menu to move the files. This will create a pair entries in the changelist for each file; the first entry is for deleting the file from the original folder and the second entry is for adding it to the new one.

这篇关于将 Visual Studio 与 Perforce 结合使用时重命名类的工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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