Get rid of override reason for TFS - visual-studio

I'd like to get rid of an override reason for some code that I've been working on, where previous shelvesets I made from it required an override reason to deal with checkin policy warnings, but where the current version does not.
However, while I can see in Team Explorer the field for override reason when my code violates checkin policy, I can't see the field when it doesn't violate the policy.
Short of deliberately making my code violate checkin policy, how can I empty out the override reason?

The shelveset saves and stores not only your file revisions, but also the Comment, the list of Related Work Items, and check-in notes (if you evaluate policies before shelving).
Select either of the following check boxes:
Preserve pending change locally : By default, this check box is selected. When this check box is selected, your pending changes
(including the comment and the Related Work Items list) are not
removed from your workspace. If you want to clean your workspace to
work on another task, you should clear this check box.
Evaluate Policies and check-in notes before shelving: When you select this check box, all check-in policies are evaluated before the
shelveset is created.
So you could uncheck Evaluate Policies and check-in notes before shelving when you are trying to unshelve. This will not keep any override reason in Team Explore.
If there is any override reason cached in Team Explore. Just manually delete them.
According to your situation, since you are working on multiple shelvesets and not check in pending changes frequently.
Since check in policy will only validate when you are trying to check in pending changes. There is no need to Evaluate Policies and check-in notes for all shelvesets each time. Which may make things complicated and confused.
The best way is unchecking this option during the shelve. And make sure you do not
violate the policy after finally check in option.
Hope this is clearly and helpful.

Related

Shelving and then Undo pending changes

I'm new at TFS in Visual Studio and I want to understand something about Shelve and Undo.
Let guess I checked out some files, made some changes and then shelved them.
In that moment - the source code which was before I made changes is restore to original code so all the team members won't see my changes?
-- or --
they see the modified code until I Undo pending changes?
And if I undo the changes - will it affect my shelvset?
So you need to understand what is actually happening. When you make changes, they only exists on your machine until you check them in to the repository.
A shelveset provides a "safe" place for you to store your changes before you check them in.
The rest of the team won't see your changes until you check them in to the repository. So when you undo changes it is merely the changes that you made to your code that is on your machine.
In your example above, your team won't see any changes until you actually check it in.
Changes in Shelvesets can be seen by the other team members, but they are not committed to the repository. They would have to go to Pending Changes -> Actions -> Find Shelveset and type you name in the user search box.
Only when you do a check-in, will others see your changes in the repository.
Undo will remove the changes locally, but the shelveset will remain so that you or anyone on the team can get the changes back locally.

Code Review Workflow + Feature Branching in TFS

We are starting to work with feature branches and we want to set up a check-in policy that only allows check-ins to the baseline when they have an associated code review.
The new code review workflow in 2012 is quite nice, since you can easily interact with the developer and other reviewers, and comment lines of code directly. Nevertheless it seems like MS didn't think the use case fully because we easily run into the following problem:
The developer works on the feature branch checking-in/shelving and forward-integrating regularly.
When she wants to integrate the feature, she merges back into the baseline and requests a review on these pending changes.
The reviewer makes several comments and now she has to change some code. Where does she do this?
Option 1: Go back to the branch, edit the code and check-in the changes in the branch. Undo the pending changes of the first merge. Merge and request a review again. Repeat until there are no more comments. Check-in the merge.
This is not so nice because all the review comments are in the pending changes of the merge, and she has to work on the branch where she doesn't see the comments directly.
Option 2: Make the edits directly on the pending changes of the merge. Request a review again. Repeat until there are no more comments. Check-in the merge.
If she wants to continue working on the branch, she would have to make a forward integration because the changes from the review are not there.
Either way, the second review is always very annoying, because you have no way of only seeing the changes between the first and the second review, since you are always diff-ing with the baseline.
Am I missing something here? Is there another option that allows reviewing the changes from a review?
Does anyone have a better way of feature branching and code reviewing?
New: Using VS and TFS2013, still no improvements :(
You're not missing anything. This is an unfortunate problem associated with the way Code Reviews were implemented, they can only be linked to one changeset, not to a range of changes.
If your team is used to a high frequency of checkins on their feature branches, then having every individual changeset reviewed using the tool may be a lot of overhead. But that would be my recommendation.
There is a trick, it's not ideal, but it may help. You can check out (on your feature branch) all files that were changed since the last checkin. Then request a review. It will create a shelveset with your changes and associate that to the review. That way you don't have to perform the merge prior to requesting the review. Just make sure you merge the latest version from main into your feature branch before pulling this trick. There are 2 major drawbacks to this:
While all changed files will be linked to the review, the changes since last review won't be highlighted automatically. The reviewer would have to manually do a "Compare to version" and pick the compare target.
There is a limit of 4000 (from the top of my head) files that can be associated to a review, so that may pose a limit to which files you can review as a group (I hope you're not changing 4000+ files between integrations into main).

Hide pending changes in Visual Studio

There are some files in my team's solution that almost never need to be checked in. Each one of us has a slightly different version of these files (ex: configuration files pointing to our individual development database or slightly modified app.config). Therefore, these files are permanently present in the pending changes view.
Is it possible to hide these pending changes so we never check them in by mistake?
Here How can I always block checkin of a specific file in TFS are some options named. To not see your changes, you should follow the workspace approach.

TFS and VS2010: Approve edits to particular project

Our team's project solution has several individual projects associated with it, one of which is designed to serve as an underlying framework for our application layer -- call it "FrameworkProject". Only in rare cases should the code for this project be edited, and in these cases I would like to be able to approve the changes to the code. Is there a TFS capability that would allow me to achieve this?
We're using VS2010 and TFS2010.
You have several options:
Implement a custom check in policy and work item type. TFS Code
Review Workflow
Look at Team Review
Implement a process that enforces that any changes must be shelve-set first allowing for a code review. Once the review has
taken place then based on permission the allowed member checks the
code into the Project.
Hope this helps.
Here are a few other options:
You can use check-in locks to prevent check-ins. You can do this by locking the top-level directory that you want to protect. Now, if someone tries to check-in, the check-in will fail and you will need to have an internal process where you review the change, temporarily unlock the folder and allow the check-in to proceed.
You could probably implement a gated check-in workflow that would send an email to you when a check-in was submitted to the given paths. From there you could have some approval process that would allow the gated check-in to complete.
You may create a "working" branch of your framework and revoke checkin rights from the main branch for everyone except the reviewers.
When someone needs to do a change, he has to change the working branch and a reviewer then has to merge the changes to the main branch in this step he will review all changes using his preferred diff tool on the mergeset before checkin in. He may revoke the merge and request fixes by simply undoing his working copy and optionally checking in review comments into the working branch.

Disable 'Keep Local Version' during checkin of code

Is there a way to disable the 'Keep my changes' button during check in?
For example:
When person A is altering class x.cs in visual studio 2010 that is under source control (TFS 2010), and person B is also altering class x.cs in VS2010.
And person B does check in his code, and after that person A wants to check-in his code, Visual Studio comes up with a message that there are conflicts:
Check In
No files checked in due to conflicting changes. Please use Conflicts Channel to resolve conflicts and try again.
Then person B can compare the code, discard his changes, but there is also a button to 'Keep Local Version'. If that button is clicked, the changes made by person A are lost.
To prevent this, I really like to know if it is possible to disable this button.
Or make a check-in policy or something to prevent this example from happening.
There's an old* saying that technical solutions to social problems rarely work. What you have here is a social problem - Person B is performing an action which is probably not what they intend. The solution should be a social one - encourage all your People to take responsibility for their checkins and above all to think while they're interacting with the shared source control system. All the policies in the world can't substitute for thinking.
Sure, you might say, but it would be nice to have a 'safety catch', or a warning mechanism, or whatever. To which I say - there already is one, and it's being explicitly acknowledged!
Also, what should happen when Person B's changes include and subsume Person A's, so they really do want to throw away the delta contributed by Person A?
(*) I found this reference from 2002, which is practically in Renaissance times for software development - I'm sure there are older
I'm a little confused. I've never seen the "newer version" message-- at least not for .cs files. Are people checking out the files they are editing, or simply marking read-only files as writable so they can make changes?
Make sure in your source control options, that it is set to either automatically check out, or prompt you to check out when files are edited.
Overall, your best bet here is training and the use of frequent forward integration. Essentially, developers should be trained to always "get latest", resolve any conflicts, and then check in. That will eliminate this problem completely.

Resources