Can TFS & Visual studio generate branch timeline diagrams? - visual-studio

Is it possible for the branching diagrams to be automatically generated by Visual studio (using info from TFS)? I know there are simple tools like this, but they have no dates! and they don't show when it was merged back into the trunk branch.
I'd love for it to generate a diagram like this:
http://i.imgur.com/Qp2XTc6.png
It needs to have dates of when the original branch was made (from trunk)... and when it was merged back into trunk.
Thanks!

If you right click on a changeset and select "track changeset" you get a view of where the changeset is and where it has been merged. You can then switch to Timeline View and see this overlayed on a timeline with dates.
http://msdn.microsoft.com/en-us/library/dd405662.aspx

There is a command line tool for TFS that at the very least can show you all of the branches that came off of trunk (and their children). It is:
tf branches <YourTrunkBranchPathHere>

Related

Summarize changes of several changesets in TFS?

I have several checkins related to a single work item. Is there a way to get a summary of all these checkins, so I can see the difference between files before I've started working on them (like, at the moment of changeset A), and their final form (changeset B)? I would use View history and compare the folders of changeset A and changeset B, but that will give me lots of diffs that were made by other people in different files that are of no interest to me.
Edit: As suggested by Patrick-MSFT, I tried to use TFS Sidekicks, but for some reason I don't seem to get any result whatever combination of filters I use.
You can achieve this by using TFS Sidekicks. You can search for your single work item and it will give you a consolidated view.
Install sidekicks for your relevant TFS version
Open side kicks and connect it to TFS (usual tfs dialogue)
Click Tools -> Code Review Sidekick
Click by Work Items and select the appropriate Project and Query (TFS explorer workitem query). Alternatively, you can search by
changesets
Select the appropriate work item.
This will show all the changes for that work item
In your case , you want to compare all of the changes to a file,
from its state before the first checkin of this workitem and the
last checkin of the workitem (collapse all of the changes)
enter code here
Right click the file you are reviewing, the one associates with the
highest changeset number, and select 'compare with previous (not in
view)' This will show you the complete difference in your VS configured
diff tool.
Note: If the file is new and has multiple checkins, select the
one with the maximum changeset it, and select 'compare with oldest
in the view'
You can use tf difference command to compare the changes between two changesets for a specified file.
tf difference /version:669~672 program.cs /format:Context

Filter Visual Studio 2013 TFS merge to only files that have actually changed

I am doing a merge between two branches and TFS/Visual Studio 2013 is identifying 1800 files required to be merged. However, doing a diff between the two branches shows that there are only ~100 that are actually different.
The pending changes window mostly corroborates this, as all files are listed with a [merge] status except those which have actually changed; those have a [merge, edit] status.
Is there a way to filter the pending changes list to only show files which are really changed so I can do inspect the differences visually? It is very error prone to have to scroll through and manually do this, skipping items that show only [merge].
My current alternative would be to do a diff on the branches, and specifically look in the pending changes window at files which are identified as different, but that is rather cumbersome for something that should be simple.
Edit: Here is a screenshot of the pending changes window. I only care about the items which are [merge,edit] as it means there is a change and I want to see the diff. Conflicts will be shown in the Resolve Conflicts window. I don't care about [merge] items, as they are identical. There are 1000s of files with no changes, but I want to single out the ones that have changed and inspect the diff.
Try the following trick:
In Team Explorer, Ctrl+A all the included changes, right click and select Undo...
You'll get the Undo Pending Changes dialog with all the items selected. First of all, uncheck everything. Then observe that you have a column named Change and you can sort by it to have all the [Merge] changes stacked together, and you can check them all together and undo only them with a single click.
There is a tool which achieves that, "qbus vMerge" - which is a Visual Studio 2012/2013 plugin available in the Visual Studio Gallery. But it's only free for team projects with up to 5 registered users. In the pre-check-in dialog, you can filter the changes by Edits, Deletes and Adds.
Link:
http://visualstudiogallery.msdn.microsoft.com/cb2f3f5b-7cea-4f2b-9d47-0e51b2619bd0
Confession: i am one of the contributors.
You can do the merge and before checking in the files, just compare your branch folder with the latest version. So if you are merging from anywhere into branch-Servicing for example, Compare $/branch-Servicing with your local workspace for that branch:
You will get a list of all files that are binary different. With a simple double click, you can view the diff.
If you want to view all changes in a merge, excluding merge-only with no changes, the easiest way is to run tf diff from the VS command line. This will use the diff tool on all changed files. I believe this shows adds as well as edits. I do wish you could sort the pending changes window by type of change action like in previous versions.
I have been struggling with the same issue. ChangeType used to be a column that was available in the list view of vs 2012 pending changes. I was hoping it would be added to 2015, but no such luck.
Here is a command-line way of doing this against the pending changes:
tf status {pathToWorkspace} /format:brief /recursive | find ", " > c:\merge.txt
ex:
tf status c:\tfs\main /format:brief /recursive | find ", " > c:\merge.txt
It's not pretty, but at least it gets the filtered list easily.
Summary of: http://thesoftwarecondition.com/blog/2011/05/01/tfs-pending-changes-ignoring-files-which-are-identical-to-the-originals/
Method 1: TFS Power Tools
Install TFS Power Tools and execute tfpt uu /noget /r * in the root of the branch. As a result, TFS will go through and undo checkouts for any unchanged files whilst leaving your modified files untouched.
Method 2: Undo Checkout
Another option is to "Undo Checkout" all the changes, and clicking "No to All" when asked to confirm for undo checkout. This way Visual Studio will "undo checkout" all the files that are not changed, and all the changed files will remain checked out.
Drawback: this method undoes renames.
My question would be why do you care?
If you do the merge TFS will figure out at run time that the files do not need modification and you will not see them as changed in the annotate tool. However if you pick-and-choose the files to merge you will leave a bunch of "pending merges" hanging around that you will have to deal with later anyway...
If there are conflicts TFS will highlight them to you for dealing with.
If you do need to compare before you merge you can use the built in diff tool in Visual Studio that will let you diff a branch (or just folders) local->local, local->Server or Server->server.

Is there a way to have a global diff before doing a checkin in TFS

With Visual Studio and TFS, is there a way to have a diff showing in a single page changes for each file before doing a checkin ? Instead of having to do diff of each file one after the other.
Similar to the UI of GitHub for Windows when doing a commit:
file1
diff
file2
diff
...
Thanks,
Edit: as mentioned by Jehan33 the view I'm looking for looks like this (it's available on the web portal AFTER a commit):
This view is available after the check-in for the change sets where it will display all the file differences for a changeset in single page in web portal. Its not possible to do the same before the check-in.
Assuming your are using Team Foundation Version Control. If you right click on the folder where you have pending changes and click Compare. Select the options
"Show Items that exists only in source path", "Show Items that exists only in target path" and "Show items that are different", you will get the desired view.
The closest thing I've found was Diff All Files.
You can choose to combine all changed files into one and compare. Sadly there is no 'lines of context', however the code is open source and you can choose an external diff tool which may achieve this.

How can I see the change log of a directory with TFS?

I'm interested in seeing the latest changes that landed to a solution with TFS (I'm using Visual Studio). However, I can't seem to find the option: using View History on a solution or project brings up the history of the file itself. Am I missing something?
If you right click on folder the containing a solution in the Source Control Explorer window you'll see all changesets. It's obvious but I had to ask for it too. I am using TFS2010/VS2010.
Edit
Here are the steps:
Team/Connect to Team Foundation Server / select Team Project/ in Team Explorer dblclick on Source Control and in Source Control Explore right click folder containing your solution select View History and here you are.
The View History command will list you all the changesets where the file/directory was changed (add/move/content changed, deleted, etc.).
So if you do a View History on a .sln or .csproj file you'll see only the changes that were made inside the file's content, not on the "Visual Studio Item" and its related item.
To sum up, the View History command is only a File System history, there's not a smarter logic out there.
EDIT
The only way to know what changed inside a solution or project is to do a View History on the common denominator (i.e. the directory that contains everything you want to view history). But it'll still be a File System kind of History.
There's not Logical History for Solution and Projects in Visual Studio. For instance you can't know what files where added to a given project your viewing the history from two given versions. Or what projects were added/removed in the solution.
All the pieces are there (because all the changes are stored in the .csproj or .sln), but the feature itself that parses the content and retrieve the logic you want to see doesn't exist. (by the way, it's a great feature and I agree it should be there).
Bottom line: TFS/Visual Studio gives you two history system:
Based on the source control/file system, by displaying changesets.
Based on the source control/file system, by displaying labels.
That's all...
Right click on folder in solution explorer, and choose View History. Then you can see all the Changesets listed that apply to that directory. Then right click a particular changeset and choose Changeset details... to see what changes occurred in that changeset.

How do we keep track of our working copy's branch?

Are there any good techniques to help us know which branch (or trunk) our working copy is from? We recently converted to Subversion and we're using release branches. I had two developers commit changes to the release branch that should have been committed to the trunk. We're using CI (TeamCity), so I recognized the problem right away and was able to revert the changes but I'd like to prevent it from happening again. From within Visual Studio, especially, it's easy to make a mistake and commit to the wrong branch.
We're using TortoiseSVN and AnkhSVN.
Edited to add:
Just to clarify, I'm looking for a method to prevent careless mistakes, I already know how to find this information. There are two careless mistakes I'm trying to prevent:
Doing work on the wrong branch. If this is caught before commit, the developer has to merge the changes back into the correct branch.
Committing to the wrong branch. This combines the pain of point 1 with having to revert the changes in Subversion.
Edited to add: We just made the switch to the VisualSVN VS plugin and it has a toolbar that displays the path of the current working copy. I really like the reassurance that I'm working on the right branch.
Perhaps you should consider using a pre-commit hook: http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html
Then you could do something like only approve checkins that have 'for release' in the comments for that particular branch or something like that and return an error message otherwise.
In AnkhSVN (in Visual Studio) the project url of your working copy is from is displayed in the 'Working on' field of the Pending Changes Window (View->Pending Changes).
The url of a file/folder is also displayed in the Visual Studio project window when you select a file in the Pending Changes Window or Working Copy Explorer (and in many cases even when you select a file in the Solution explorer; but this depends on the project type).
[Update: I just added AnkhSVN issue #581 for extension of the commit dialog.]
Tortoise SVN adds columns to the Windows Explorer view. In "Details" mode, right-click on column headers to get a list of available columns, at the bottom, select "More" to get a dialog of all available column types.
SVN short URL should quickly show you what the location is in the repository.
But this doesn't appear to work under vista ...
Right click the folder, move to the subversion tab, there it says the project it's linked to.
Also, in the commit dialog, it says so at the top of the dialog.
From the working directory:
svn info
URL will contain the branch your working directory points to.
<EDIT> Seeing how many people dislike the command line, the closes thing I found from TortoiseSVN is the "repo browser" which seems to use the selected branch as your starting path in the repo. </EDIT>
Avoid re-using working copies. If you're working on 2 places in the repository, have 2 working copies, named appropriately, like: Project-trunk, Project-release.
Here is a simple idea which might help:
Create an empty text file named "branch_XX" (or any name) and add it to your branch.
commit this and then when you switch to the trunk, the file will not appear in the solution explorer.
It sounds stupid... but it does the trick.
I really hope they will add something that might mark what branch we are using without going to other windows.
In AnkhSVN (in Visual Studio), right click on your project/solution, then Source Control -> Subversion -> Select in Repository Explorer. It will automatically select the branch you're currently working on (i.e. the branch you're switched to).
I don't think that the accepted answer for AnkhSVN works for Projects, since I always see the same URL in the "Pending Changes" even after I use the option "Switch Project" on a project.

Resources