none
How to find a work item's code review request

    Question

  • I've searched around for an answer and am struggling here.

    We are using VS2013 connected to TFS2012.

    We use a 1 tier branch, so everything gets committed and released from that. Before a commit a code review request is created. Only when the code review passes will the code be committed. This all works fine. However now we are currently being audited and when looking at a task I cannot see the code review associated with it. However if I search by a code review work item I can find the related task to it.

    I can't upload images until my account is verified, but am happy to do so once it is if further clarification is needed.

    If I search by code review work item (say 14716) I can find the related task work item (say 14715) quite easily in the "Related Work Items" under Team Explorer.

    However to satisfy the auditors I need to know the code review by a task work item. When I search by task work item 14715 there is nothing telling me what code reviews are linked to it.

    The fact that Team Explorer shows a connection proves that code requests and tasks are linked.

    But how do I find this out when searching at a task level?

    We have tried both the SQL warehouse and even the TFS API but no success.



    Regards

    Mark Eaton
    Thursday, June 26, 2014 5:56 AM

All replies

  • Hi Mark, 

    Thanks for your post.

    Yes, you’re right. We need open the code review work item in Team Explorer to check the related work items in it, and there’s no the Link relationship between code work item and related work item. 

    For this scenario, please submit it to User Voice site at: http://visualstudio.uservoice.com/forums/121579-visual-studio. Microsoft engineers will evaluate them seriously.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 26, 2014 9:46 AM
    Moderator
  • Thanks John for the quick reply and providing me an avenue to escalate this.

    The auditors are asking for a lot of evidence on our development practices and, except for this one issue of not being able to prove that a code review was done for a task, we have been able to satisfy them.

    As such it makes our development team look sloppy in this matter and it won't look good when they submit their final report to the shareholders.

    Regards

    Mark Eaton

    Thursday, June 26, 2014 11:14 PM
  • Hi Mark,

    Thanks for your reply.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay.

    Appreciate your patience.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, June 27, 2014 2:00 AM
    Moderator
  • Thanks John for trying to assist me here.

    I have taken up your suggestion and placed a post as well for the TFS engineers.

    http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6104804-allow-the-ability-to-prove-that-a-code-review-was

    Feel free to vote ;-)

    Regards

    Mark Eaton

    Friday, June 27, 2014 4:20 AM
  • Hi Mark,

    Does the JmacHale's reply help you? See:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/1e9d2c0d-e450-493d-9860-809064b1cf0e/find-task-work-item-linked-to-code-review-in-tfs-warehouse?forum=tfsreporting

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, June 27, 2014 7:47 AM
    Moderator
  • Hi Vicky

    Myself and another TFS administrator tried that. We spent 1/2 a day each using that query in the link as a guide to help us but no good. All I could get out of it was a code request work item linking to a code response work item.

    It may be easier if I can give you screenshots so you can visualise what I see in VS2013. My account is still not verified. Is it ok to get that done as I do believe it can help?

    It doesn't make sense to me as in VS team explorer when searching by code review it shows the work item task under "Related Work Items". So somehow TFS knows it is linked. Yet if I go by the reverse and search by task it will not show me the code request.

    Regards

    Mark Eaton

    Friday, June 27, 2014 9:46 PM
  • Hi Mark,

    Are you able to post your screenshot here now? Or you can upload it to the OneDrive then post back the link.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 04, 2014 9:18 AM
    Moderator
  • Hi Vicky

    I am still not allowed to add links or images until my account is verified. I have had an MSDN license with my company for several months now so I am somewhat surprised by this.

    Is there a way of prioritising my account so that it can have this access?

    Also as my original post was now 2 weeks ago I would have thought that to be more than enough time to give me this access.

    Regards

    Mark Eaton

    Monday, July 07, 2014 1:04 AM
  • Hi Mark,

    To be honest I have no idea why your account is still not verified, but you can upload the screenshot to the onedrive, then send back the modified link here.

    In addition, I already vote your idea on the Microsoft UserVoice site. I find that there is no available TFS feature supports to get all code review items for a task. But I think it can be done via TFS API. 

    Before you start with TFS API, you'd better be clear of the logic among code review items, changesets and tasks: The code review is related to the code/changeset – which is then linked to the task. See Cathy's reply in this case. So, to work with TFS API, you can first find out one Task work item is associated to which changesets: http://blogs.msdn.com/b/buckh/archive/2006/08/12/artifact-uri-to-changeset.aspx .

    Then go through all code review items, find the code review item's changesets:

        if (workItem.Fields["Microsoft.VSTS.CodeReview.ContextType"].Value.Equals("Changeset"))
                {
                   var changesetID =  workItem.Fields["Microsoft.VSTS.CodeReview.Context"].Value;
                   Console.WriteLine(changesetID);
                }

    Then associate the code review items with Task work items together.

    I know the above method is somewhat awkward, but it should help.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 07, 2014 7:21 AM
    Moderator
  • Thanks for trying to help me here Vicky and for the vote. I haven't tried your suggestion yet but I am expecting it not to work. The reason? There is no changeset to interrogate. Hopefully the below can explain.

    I have 2 public images on OndDrive. To help here 14715 is a Task, 14716 is a Code Review request. There are no changesets here as nothing has been committed.

    The first image shows from the perspective of a code review request. Notice that under "Related Work Items" it is linked to a task, not a changeset. https://onedrive.live.com/redir?resid=ED41023C0A9A2E6D%21107

    The second is from the perspective of a task. Notice how there is nothing about a code review here. Also there is no changesets as nothing has been committed. https://onedrive.live.com/redir?resid=ED41023C0A9A2E6D%21108

    I read the post you gave me and it seems that Microsoft want us to link code reviews with changesets. However TFS actually allows us not to do this which is causing all the confusion with people around the world (as the 2 links above highlight, and the post you gave me too showing peoples' frustration).

    Ultimately the code will be checked in, but only after a fellow developer passes a code review. It looks like as part of the check-in process we need to link the code review as part of it, which TFS doesn't enforce. As such the code review becomes an orphan? But this is still strange as when viewing the code review you can see the related Task. Just not vice-versa.

    It appears TFS is allowing people to create code reviews that don't need to be linked to changesets when it shouldn't be?

    It does seem when moving forward with my team that we need to have a discipline to always link code reviews as part of the check-in process. And if we forget? Well it is lost in the TFS repository. This does come across as a work-a-round to me.

    Hope this information helps.

    Regards

    Mark Eaton

    Tuesday, July 08, 2014 11:26 PM
  • Hi Mark,

    Seems that you don't do code review for checked in files, instead you want to do code reviews for these unchecked files. And in this situation, instead of find changeset you should find the shelveset as at this time code review request is associated with shelvesets.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, July 10, 2014 3:28 AM
    Moderator
  • Thanks Vicky. I will give this a go.

    Regards

    Mark Eaton

    Tuesday, July 15, 2014 10:06 PM