C# TFS 代码审查 - 显示更新的文件以响应评论

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18322791/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 11:55:02  来源:igfitidea点击:

TFS Code Reviews - Show updated files in response to comments

c#visual-studio-2012tfstfs-code-review

提问by John

We are beginning to use the code review functionality built-in to VS 2012 and VS 2013 preview. Requesting the review and adding comments seem pretty straightforward. If someone adds comments requesting the code to be changed, then how does the requester make these changes and show them?

我们开始使用 VS 2012 和 VS 2013 预览版内置的代码功能。请求和添加评论似乎非常简单。如果有人添加评论要求更改代码,那么请求者如何进行这些更改并显示它们?

So the process would flow like this:

所以这个过程会是这样的:

  1. Person 1 requests a code review.
  2. Person 2 adds comments and selects "Needs Work."
  3. Person 1 makes the necessary changes.
  1. 第 1 个人要求进行代码。
  2. 第 2 个人添加评论并选择“需要工作”。
  3. 第 1 个人进行必要的更改。

How does Person 1 now show these changes to Person 2? You can add comments and send them, but the files don't change. I'm assuming the files are from the changeset created when the original review was requested. Should Person 1 close this review, and request a second review?

人 1 现在如何向人 2 显示这些变化?您可以添加评论并发送评论,但文件不会更改。我假设文件来自请求原始时创建的变更集。第 1 个人是否应该关闭此审核,并要求进行第二次审核?

Creating a second review doesn't seem optimal, because you lose the history of your conversation of why you were making the changes.

创建第二个评论似乎不是最佳选择,因为您丢失了您进行更改的原因的对话历史记录。

There are ton of websites showing how to use the basic functionality of the code reviews, but are there any sites that show the best practices? For instance, who should be clicking the check boxes next to files?

有很多网站展示了如何使用代码的基本功能,但有没有展示最佳实践的网站?例如,谁应该点击文件旁边的复选框?

采纳答案by Chad Dienhart

So the process would flow like this:

所以这个过程会是这样的:

  1. Person 1 requests a code review.
  2. Person 2 adds comments and selects "Needs Work."
  3. Person 1 makes the necessary changes.
  4. Person 1 Updates the shelveset associated with the code review
  5. Person 1 adds comments to continue the discussion
  6. Repeat steps 2 - 5 until accepted
  1. 第 1 个人要求进行代码。
  2. 第 2 个人添加评论并选择“需要工作”。
  3. 第 1 个人进行必要的更改。
  4. 人员 1 更新与代码相关的搁置集
  5. 人 1 添加评论以继续讨论
  6. 重复步骤 2 - 5 直到被接受

Here are the steps necessary to update the shelveset associated with the review.

以下是更新与评论关联的搁置集所需的步骤。

  1. From the "Code Review" pane select the "view shelveset" link
  2. From the "Shelveset Details" pane highlight and copy the shelveset name
  3. Navigate to the "Pending Changes" pane, click on "Shelve" and paste the shelveset name
  4. Press the Yes button on the shelveset replace verification dialog
  5. Now the reviewer can see the updated files and the review discussion can continue
  1. 从“代码”窗格中选择“查看搁置集”链接
  2. 从“货架集详细信息”窗格中突出显示并复制货架集名称
  3. 导航到“待定更改”窗格,单击“搁置”并粘贴搁置集名称
  4. 按搁置集替换验证对话框上的“是”按钮
  5. 现在审阅者可以看到更新的文件,审阅讨论可以继续

I've included some screen shots as I find it helps to clarify things.

我已经包含了一些屏幕截图,因为我发现它有助于澄清事情。



1) From the "Code Review" pane select the "view shelveset" link as shown here:

1) 从“代码”窗格中选择“查看搁置集”链接,如下所示:

enter image description here

在此处输入图片说明



2) From the "Shelveset Details" pane highlight and copy the shelveset name as shown here:

2) 从“货架集详细信息”窗格中突出显示并复制货架集名称,如下所示:

enter image description here

在此处输入图片说明



3) Navigate to the "Pending Changes" pane, click on "Shelve" and paste the shelveset name for example:

3) 导航到“Pending Changes”窗格,单击“Shelve”并粘贴搁置集名称,例如:

enter image description here

在此处输入图片说明



4) Press the Yes button on the shelveset replace verification dialog:

4) 在搁置集替换验证对话框上按是按钮:

enter image description here

在此处输入图片说明

回答by Paddy

I believe the correct procedure is fore Person 1 to make the changes and request another review. When your code needs work that means you will be changing it so you will want to have the old version to look back to for comparison. You still have the old review in the history after it is closed if you wish to look over the comments. We are currently in the process of optimizing our code review process in my workplace.

我相信正确的程序是第 1 个人进行更改并请求再次审核。当您的代码需要工作时,这意味着您将对其进行更改,因此您需要回顾旧版本以进行比较。如果您想查看评论,则在关闭后,您仍然可以在历史记录中保留旧评论。我们目前正在优化我工作场所的代码流程。

回答by Ville Pelho

You have to do this with two different reviews. But there is also a way to keep the history with the second review. All you need are tasks.

你必须用两个不同的评论来做到这一点。但是还有一种方法可以通过第二次保留历史记录。你所需要的只是任务。

This workflow is described for changeset based reviews, but it works also for shelve based reviews.

此工作流程适用于基于变更集的,但它也适用于基于搁置的。

  1. Create task1
  2. Before checking in changeset1 add task1 as a related work item
  3. Check in changes with one work item related and request review to this changeset
  4. Create task2
  5. Before checking in changeset2 add both tasks as a related work item.
  6. Check in changes with two work items related and request review to this changeset
  1. 创建任务1
  2. 在签入 changeset1 之前,将 task1 添加为相关工作项
  3. 签入与一个相关工作项的更改并请求对此更改集进行
  4. 创建任务2
  5. 在签入 changeset2 之前,将这两个任务添加为相关工作项。
  6. 签入具有两个相关工作项的更改并请求对此更改集进行

Now in the second review request the reviewer is able to look for related tasks and if the reviewer takes a look for task1 he/she sees the changeset1 and the review request with its comments. So you wont be losing the conversation history.

现在在第二个请求中,者能够查找相关任务,如果者查找​​ task1,他/她会看到变更集 1 和请求及其评论。因此,您不会丢失对话历史记录。

回答by julealgon

I know this question is old, but it's still not supported as pointed out by other posters. The solution proposed by chad will work for some things but will have odd behavior for others.

我知道这个问题很老,但正如其他海报所指出的那样,它仍然不受支持。乍得提出的解决方案对某些事情有效,但对其他事情会有奇怪的行为。

Recently, the TFS team began the planning stages for a solution to a very old uservoice request to enable updating of a Code Reviewwhich should elegantly solve this problem by making Code Reviews have iterations.

最近,TFS 团队开始了针对一个非常古老的用户声音请求的解决方案的规划阶段,以启用代码的更新,这应该通过使代码具有迭代来优雅地解决这个问题。