How to browse TFS changesets? - tfs

I want to browse TFS changesets.
I do NOT want to search changesets by specifying a file contained within the changeset. I do not want to specify which user I think created the changeset.
I simply want to key in a changeset number and look at that changeset. Or maybe view a range, and then browse those.
No specified file, no specified user. TFS 2008 seems to not want to allow me to do this.
I must be missing something.
How do you do this?

In Source Control Explorer, hit CTRL+G. This will bring up the Find Changesets dialog. Unfortunately it's kind of one-size-fits-all in VS 2008: you have to work inside a big bulky search dialog, even if you already know the number(s). In your case, flip the radio button to search by range and then key in the desired changeset number as both the start & end of the range.
The VS 2010 version of this dialog simplifies the "lookup single changeset by #" use case, FWIW.
My personal preference: if you have a console window open, there's a quicker route. Simply type tf changeset 12345. If using the Power Tools, you can substitute "Get-TfsChangeset" or "tfchangeset" for improved performance and programmability.

in the Source Control Explorer window, right-click on any folder in the source control tree and select View History. this will give you a list of changesets that touch that folder (recursively). It's not a way to key in a changeset, but it's another easy way to see changesets
you can also right click on a folder and select Find in Source Control -> Changeset... which will allow you to enter a changeset number or range.
** these might be part of TFS Power Tools

On the website which is provided by TFS or on Visual Studio Online, go to your team home page. Then on that page click on the link Code then Changesets which after loading provides a list of the historical change-sets.
Steps

1. Open Visual studio and find Team Explorer(right hand side of computer screen).
2. Click on Team Explorer and Look for Source Control Explorer.
3. Now Click on Source Control Explorer.
4. Now Press CTRL+G
5. Changeset popup will come up.
6. Enter Changeset Number.
7. Click OK button of Changeset Popup.
8. Changeset Details will come up.
Thanks... :)

Related

How to undo pending changes in TFS of users that no longer exist

We have a few developers who don't work here anymore, but didn't check all theirs changes into Team Server before they left.
Now their usernames don't exists anymore, and I can't access their pending changes to undo them....
I found a way, not needing command line.
With Power Tools installed (both in 2008 and in 2010 version), Visual Studio shows a node for Team Members in each project. If you right-click on one of the members, you can choose to view all their pending changes. Till now nothing new. BUT, I suddenly saw, in the right hand upper corner of the pending change list, a link that says "Modify Query".
I opened the window, and in it was an input field that let me change the username. I changed it to the username I wanted, and I got his list of pending changes!
Here's a link to the TFS 2008 Power Tools:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=FBD14EEA-781F-45A1-8C46-9F6BA2F68BF0
and the TFS 2010 Power Tools:
http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Edit by woppers:
I don't have enough Rep to comment so I have to make an edit. I had the same issue as the OP but I am working in TFS 2013 so the procedure is slightly different. Here's what I did.
Go to:
Source Control Explorer
right click on the collection you are working in
Find
Find Changesets...
Enter your LanID in the “By user:” field
Click search
Click find
That will show you all of your pending changes.
Highlight one of them and click “Details...” to view the info in them.
As an administrator of TFS you should have some option of global check in.
something like that in the command line: tf lock /lock:none /workspace:workspace;username $/code/foo.cs /s:http://server:8080
or better yet:
tf undo /workspace:workspace;username $/code/foo.cs /s:http://server:8080
To expand a bit on the awesome answer provided by xr280xr... I needed to undo pending changes of a former employee, and this worked for me on a TFS 2013 server, using VS2015 on my own desktop:
Right click the folder in Source Control Explorer > Find > Find
by Status and enter * as a wild card. You can reduce the results to
a specific user if you know the user name.
When the results appear, you can right-click and select Undo. The
Output window should confirm success.
Note that if the former employees' workspace is on another PC, you'll continue to see the pending changes they have, but they will no longer prevent checkout, build, etc.
I'm guessing that deleting the former employees workspace will get rid of the pending (now-undone) changes, but I haven't tried it yet.

How can I open a single changeset in TFS from within Visual Studio

Someone emailed me a TFS changeset ID and now I am trying to open this single changeset. Is there an easy was to do this from within Visual Studio (VS 2008 if it matters)?
In Visual Studio a keyboard shortcut can be used for pulling up a specific Changeset or Work Item.
Go to Changeset
In Visual Studio open the Source Control Explorer window and while it has context press Ctrl + G. Enter the number in the Go To Changeset dialog and press OK.
I know this works in VS 2010, 2012 and 2013, but recall this working as far back as at least Visual Studio 2008.
Go to Work Item
Pressing Ctrl + G when the Team Explorer Work Items window has context brings up the Go To Work Item dialog:
In Visual Studio 2012 and 2013 the TEAM menu contains an option Go to Work Item which also brings up this dialog.
Last Word
Visual Studio is a very contextual program and what happens when a specific keyboard command is used is oftentimes influenced by what window has context. To be clear pressing Ctrl + G when an editor window is open will present the Go To Line dialog.
As with many keyboard commands in Visual Studio your mileage will vary.
In the Source Control Explorer (View -> Other Windows -> Source Control Explorer):
Right click on the folder you want to grab
Click Get Specific Version
Change the dropdown from "Latest Version" to "Changeset"
Find your changeset on via the browse (...) button.
Change to search to changeset number
Just select the result and hit ok.
Alternatively, if you want to see what changes were in that changeset...
Go to the same Source Control Explorer
Click the History button (looks like a clock)
Scroll down the changeset list that appears, double click the one you want.
This will list the files changed in that changeset as well as notes the developer put.
or, from a VS command prompt type "tf changeset 1234" (make sure that your root folder is inside of your workspace or you will have to explicitly define the team project etc.)
You don't need to remember Ctrl + G shortcut, just do as below.
Open the source Control Explorer -> Right Click -> Find in Source Control -> Changeset
Then a dialog box will appear where u can specify your changeset number hit find. And it will appear in results section at the bottom, then you could go into all its details.
In the NugGet console, you can use the TFS Powershell Snapin from the TFS PowerTools.
Add-PsSnapin Microsoft.TeamFoundation.Powershell
Get-TfsChangeset <ChangesetNumber>
Another option is to open Tools > External Tools and add a new external tool that calls TF.exe changeset and prompts for arguments where you can give the changeset number.
In VS2012 you have the option to search in changesets.
if you want to search changeset...
Go to Source Control Explorer Click the Find Changeset(looks like some papers tied together) button. it is near to history button (looks like a clock)
you can search by changes checkedin by a user,containing file,and date range
try to add as much filter as possible, otherwise it will take sometime to load.

Is there a way in TFS to see all the files that have been worked on by different users?

I have 3 people working on 1 Team project in TFS. I want to see all the users' work from the date when this Team project was branched until the day the last user checked in his work. It's required so I know how many files to transfer to another server.
Does anyone know if there is a way? I did "view history" and it didn't really give me what I wanted.
Get yourself a copy (free) of the TFS Power Tools. It contains a great feature called Find In Source Control. This allows you to search for check-ins based on a number of criteria, including a range of dates, or a begin and end changeset number, and more.
Randy Minder's answer should meet your needs as stated in the question. But, if you want to see the work represented in another way, you can compare your work to the server path from which it was branched.
From the View menu, choose Team Explorer. Browse to the project your project and double-click on the "Source Control" node. This opens your "Source Control Explorer".
In Source Code Explorer, right-click on on the folder where you've been working. Choose "Compare" from the menu. This will open a dialog that compares two server locations for differences. By default, the folder you've just clicked on will be the Target Path of the comparison.
In the dialog, click on the Source Path Browse button and choose "Source Path". Another dialog will appear, asking you to choose a path on the server.
Browse to and choose the server path from which you branched.
Visual Studio will now give you a comparison (recursive through folders) of the two paths, showing which files have changed and easily letting you inspect differences and histories of those files.
If the Source Path hasn't changed since you branched, and you've checked everything into the Target Path, the "Folder Difference" pane should represent the work you've done since you branched.

TFS Branch/Merge meets History View

We have a setup with a development "trunk" in our recently-migrated-to-from-VSS TFS system and developers have been doing work in branches off the trunk, which are merged back in.
We've been diligently commenting our changesets at check in time, something we never did in the VSS days. However when I right-click on a trunk file in the Source Control Explorer and choose History, I only see monolithic changesets labeled "merge from dev branch" (or whatever the developer scribbled in there when they merged.) A history entry doesn't even seem to contain info on which branch was merged in at that time, let alone any info about the changesets that make it up, or the comments that go with them.
How have other TFS users dealt with this issue?
Is there another way to view the history that I'm missing here?
Looking at the history of a change prior to the merge has been a bit of a pain point with TFS. So much so that Microsoft have done a lot of work to address this in the next version of TFS (TFS 2010). In TFS 2010 (when it comes out), when you get to a merge in the history view it is actually a little twistie that you can expand and go see the history for the thing that was merged which is much nicer.
In the meantime, when I see I big monolithic merge (or branch) comment I tend to let out a audible sigh and then go find the file in the branch it was merged from in Source Control Explorer and do a view history there.
This might be what you are looking for: http://www.codeplex.com/TFSBranchHistory
Haven't used it personally, so I can't vouch for it.
Visit "TFS Branched History" plugin page at Microsoft Gallery:
http://visualstudiogallery.msdn.microsoft.com/7d4f37b6-f9a4-44c6-b0a0-994956538a44
Plugin does insert "Branched History" button into the context menu of Source Control Explorer (TFS)
The button icon is with clock like standard "History" but with blue arrow:
If you click "Branched History", new window will be opened and Path property will be set to the current Source Control Explorer path:
Click "Run query" to get results at the "History" tab:
From context menu you can query standard Changeset Details and Compare File (Folder) dialogs.

Query TFS for updated files

I want to get an overview of files that are updated in TFS (that someone else checked in) that I don't have the latest version for.
In Visual Studio Source Control Explorer, right click on the directory you want to compare, and select "Compare". It will pop up a dialog with a couple of filtering options, and then show you what's out of date.
if they checked them in as part of a single changeset then you can find them that way.
(right click file in solution explorer, view history, double-click on the relevant changeset and you'll see all the related files for that checkin)
Is your question about finding this info via the TFS API via the website, or via the visual studio interface?

Resources