How do I associate a review request with multiple changesets in TFS 2012
Asked Answered
B

4

30

Our development process works like this: Every 2 weeks the team lead (me) goes in and reviews everyone's changesets to make sure they are up to the coding standards. I would like to use TFS 2012 to help automate this process.

There are 2 problems with this:

  1. There is no way to submit an unsolicited code review. I can live without this if necessary, I guess

  2. There is no way to associate a code review with more than one changeset. This is a deal-breaker

I read one article which said it's possible to link changesets to a work item after the fact and when I open the work item for the request review I do see the Links tab. However, when I click "New" or "Link to...", there is no option to link to a changeset. There is only an option to link to each work item type in the process.

Does anybody know how to do this? Are there any plans to add these features to TFS?

Here's a screenshot:

No changeset option to be found... :(

Boykin answered 17/12, 2012 at 16:43 Comment(1)
More of a workaround than a solution: to give unsolicited review, I check out the files myself, code some suggested changes and request a review from the original author.Feria
D
10
  1. Unsolicited, no.
  2. You can rightclick a changset in the history screen to request a review post checkin.

And there is a nasty workaround to get what you want to achieve. Check out all files you want to review and request a review. You can then undo your checkout, the shelveset and the review request will remain.

Alternatively you can just go to the source control tab and do a checkout-all on the rootfolder of your solution, request the review, undo your checkout and do the review.

As for linking changesets to a Work Item, this can be done post checkin. Open the work item, go to the links tab and click "Link to..." The dropdown there will have a "Changeset" option. But I don't think this link type is enabled for Code Review Requests, since these use a Shelveset and not a set of changesets as the source for the code to review.

enter image description here

I expect you could use the TFS API to generate a shelveset with all the changes from a specific developer in a given timerange, put these on a shelveset and request a review on that. But no existing feature to do that exists.

Or you might be able to edit the shelveset of associated to the review by creating a new one with the same name.

Delsiedelsman answered 18/12, 2012 at 0:33 Comment(6)
1. Dang. 2. I like your suggestion about checking out the entire tree, but unfortunately it doesn't work. Tfs complains that it has a limit of 2000 files per review request. We have close to 7000. :(Boykin
I feel like Microsoft just doesn't want me to use this feature... :(Boykin
If I do it the way you suggested, the reviewer will not see what has changed in the files and doesn't know what changes he has to review.Affusion
@Affusion they can always do a compare to previous version. Or to latest to see what to review.Delsiedelsman
@Delsiedelsman I guess I have to write down all the changeset numbers that the reviewer is supposed to compare each file to (as a comment for each file right into the request), which is far from ideal.Affusion
Just tell them which base changeset to compare to.Delsiedelsman
K
1

An alternative approach:

1) at the beginning of the two week cycle, initiate the code review process and note the work item number that is created. Simply request a review from yourself with no code changes at first.

2) Have all your developers associate their check ins for the next 2 weeks with that work item #

3) When you are ready to perform the review, simply open the work item and go through the changesets.

That should accomplish what you want.

Keever answered 20/12, 2012 at 4:6 Comment(3)
In the tool it doesn't work that way, since you can't request a review for a workitem. A feedback request is associated to a Changeset or a shelfset.Delsiedelsman
Right, but you can request a review of a dummy changeset/shelveset (just a space of whatever), associate that review request with a work item which will create the link, and then continue to associate changesets with the review request work item number right?Keever
You can associate the changesets to the same work item, but that will not associate them to the actual Code Review and the changes won't be shown in the Visual Studio UI.Delsiedelsman
B
1

Option #3

[I'm assuming here that the changesets that your are trying to associate to a single code review are consecutive, for example 20001:20010]

  1. I "roll[ed] back to a specific changeset" (in my example above 20001). I check it in the changes. The code is now in its original state.

  2. Then, I "roll[ed] back to a specific changeset" (in my example above 20010) and check it in again. The code is now in its final state.

  3. Finally, I request a review on the latest revision. This review compares the latest two commits - the ones I created from the rollback.

As a bonus you can compare specific changesets in the history page. You can use this compare to make sure that the commits above did in fact revert the code to revision 20001 and 20010.

Bumbling answered 8/11, 2017 at 18:2 Comment(0)
C
0

On item #2, I have a standard work around that you might like to combine all changes from many changesets into one shelveset for review. I tried the checkout method mentioned above and ran into issues, partly because my review had 25 files or so and after checking them out, if I refreshed, TFS removed them from pending changes because it TFS's opinion there were no changes.

First, (assuming that your changes are already checked in, and in multiple changesets), have a workspace with the latest files on a disk path such as D:\Latest...

Create a new "local" workspace (called "Review"), map the same project to the slightly different path (say, D:\Review...") get all the files. Go to the history of that project and just before your earliest changeset, right-click and select "Get this version".

At this point, go to the history and rollback any changesets that someone else may have changed in the meantime, if any, that you don't want to be part of the review, unless someone changed a common file. Leave those.

Using beyond compare, compare "D:\Latest..." to "D:\Review...", copy your changes from Latest to Review. Go into the common files and copy only the lines that you want reviewed. When Beyond Compare writes out the changes, TFS will detect the change and put the file you save in your pending changes list for the "Review" workspace. (That's a feature of local workspaces.)

At this point, you just shelve your pending changes from the "Review" workspace, and request a review on that shelveset.

Coping answered 16/11, 2016 at 16:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.