Is there an Visual Studio 2010 extension that would allow you to insert comments and automatically append your username and current date:
// You type comments here [by Toni, on 03/26/2011]
It would help us to maintain uniform comments format in our solution.
Edit: This question is not about VCS, I am aware you can add and enforce comments there. I am just looking for Visual Studio 2010 Client only solutions!
That should be handled by your version control system since it's more a code metadata than a code itself. Leaving it in code may lead to more troubles than taking from VCS in case if somebody will update a comment but will forget to update an author. Most modern VCS have blame command (see SVN blame for example) which will show the revision and author of that comment line.
I tend to agree with snowbear that keeping track of who wrote what code belongs in source control. If for whatever reason it makes more sense for your group to have the comments in the code, then you could probably get away with just creating a visual studio macro and tieing it up to a hotkey. Something like the following should suffice:
Sub TaggedComment()
DTE.ActiveDocument.Selection.Text = "// [by "
DTE.ActiveDocument.Selection.Text = Environment.UserName
DTE.ActiveDocument.Selection.Text = ", on "
DTE.ActiveDocument.Selection.Text = DateTime.Now.Date.ToShortDateString
DTE.ActiveDocument.Selection.Text = "]"
DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.CharRight(False, 3)
End Sub
Alternatively, you could look at creating a Code Snippet instead (which seems to be the more performant solution).
Have you looked at LogSubstPol on codeplex?
I quote:
LogSubstPol is a TFS check-in policy
which inserts the check-in comments
and other keywords into your source
code, so you can keep track of the
changes even if you are not connected
to TFS. It can be compared with the
$log$ (and other) substitition in any
other CVS systems.
Otherwise, you can write your own :-) It should be based on TFS checkin policy extensibility, using the PolicyBase Class
Related
In source control systems and tools like tortoises for svn or sourcetree for git, when I am committing a merge, I can usually just left a default comment generated by the tool that is basically a summary of what changes were merged. In visual studio using TFS, there is a comment textbox right above the changes list, but I have to type it all manually. It's not super important but it is a time saver sometimes. Maybe i'm just not looking at the right place.
If you're using TFS with Git, then this becomes less of an issue. When you merge all the individual commits come along for the ride, so it's not necessary to re-describe them in the merge commit.
Try extension Auto Merge
If you need set original comment setup Settings "comment_format" like {{OriginalComment}}
I have used TFS a lot, and unfortunately I don't think that option exists. I usually copy my original checkin text and then paste it if I am doing multiple merges. I realize this is a low tech way to do it and the original comment isn't generated for me. If you want to be able to do this bad enough, you can probably write a Visual Studio plug in that would do it for you, or you could code up just about anything you want to add with the Team Foundation Server SDK.
I'm working in VS 2010 and am connected to a Team Foundation Server.
In order to edit source files I have to check them out from the server. After I'm done with editing, I have to check them back in (to make changes visible to everyone else) or discard changes.
I am currently in the process of getting acquainted with the architecture and systems, so I'd like to add a lot of personal comments while I play around with everything.
However I'd prefer to not make these comments visible to everyone else. (And I dont want to delete them everytime I commit changes via check-in)
Is there a VS function I did not yet discover or a plugin that allows me to enter comments that dont get commited to the TFS? Maybe something like virtual post-its, just something that lets me attach stupid reminders on certain blocks of code?
(yes I know, proper documentation would make this obsolete but the system is as it is and its huge and I'm not the one to document this all, just want to get used to the code)
VS2010/TFS2010 no built in functionality that I know of, for TFS2012 you could possibly use code reviews.
Maybe the Visual studio extension StickyNotes is what you want.
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.
To preface this I am an Emacs refugee on Visual Studio 2010's shores and am certain that I am working against the tool. Please could someone point me in the right direction. My problem is the MyProject.csproj file is kept under version control using TFS and my coworkers have made a number of changes that no longer get along with my version. Not a problem, I can just merge the changes and make things right. But I can't, or rather I don't know how to. The compare tool in VS only taunts me, it won't let me pick and choose differences like I need to.
What I would love to do is just use Merge in Emacs, run through the file hitting L(eft), R(ight), B(oth) and be done with it in no time. What I don't understand is why there are certain changes that are accepted by default, that I cannot alter. I think that what it is doing is identifying changes that I made to the ancestor document and forcing those to be made while providing me the option of merging the changes from my coworkers. My issue is that these things are contradictory and I would like to ignore my change to Line 12 while accepting the Repository's Line 42 but applying my Line 106.
But I cannot figure out how to tell it "no" to Line 12.
This has to be common, what does one do in VS to get this to work?
Thanks!
The standard diff tool that comes with Visual Studio ... blows. Its not intuitive and doesn't work all that well.
But its very easy to integrate different diff tools. I'm using this one:
http://visualstudiogallery.msdn.microsoft.com/en-us/dace3633-0b51-4629-85d4-c59cdce5bb3b?SRC=VSIDE
(no affiliation; its free so don't ding me for spam kthx). Works pretty damn good. You might find one out there better suited for your tastes, in which case you can integrate it into visual studio. (again, not associated with me!)
I advise you to use WinMerge to compare or merge files with VS
You can define as Will said.
I'm actually working on a tool that need some configuration before it can be used. To save some time a hard coded some values into the text boxes of the configuration tab, so I don't have to renter them every time I do some testing or debugging.
As we're using TFS to manage our solutions I'm wondering if there is a way to mark those hard coded elements in some way so that TFS or Visual Studio 2008 will remind me to remove/replace them before I do a check in.
UPDATE:
The todo comments won't be a real solution as we're already using it to mark code segments which have to be reworked. We use it as a reminder for longterm tasks. And we have plenty of them so this might become a little bit unclear.
Some options:
write a custom checkin policy
use the existing FxCop checkin policy and write a custom rule (if you're marking TODOs with something that gets actually compiled, like an Attribute)
ditto, but via the StyleCop checkin policy (if your TODOs are source comments)
Probably not the perfect solution, but Visual Studio let's you add TODO comments that may work well enough for you.
You could write a unit test that fails when the hardcoded stuff is found. Obviously, you won't get a reminder before checking in but you do get a build failure afterwards.