This is the next part in my series of TFS vNext posts:
Part 1: The My Work Tab
Part 2: Pending Changes
Part 3: Code Review
Local Workspaces is a new feature in TFS11. Fundamentally, it is the biggest change that existing TFS developers developers will feel as they interact with this new version.
In TFS 2010 and previous versions, workspaces were “server” workspaces, which means that the server has the master copy and the server must be notified before any change is made to a file. This is known as an “Edit-Merge-Commit” style and it’s typical of a server-centric solution.
TFS11 introduces Local Workspaces which moves the ownership of the workspace (and its files) to the client and it’s up to the server to accept changes made on the client. This style is called “Modify-Merge-Commit”. The first thing that people will notice is that when you get latest, the the files are no longer read-only and the moment that you start making changes to them, Visual Studio will be aware of the changes. The important thing here is that the TFS server does not need to be notified of these changes, which also means that our offline experience will be much better. This is how SVN works as well.
It is important to note that Local Workspaces is the new default, so there is nothing that you need to do to make this happen. Let’s take a look at the “New Workspace dialog” (on Advanced mode):
The Location drop-down shows us the available options of “Local” and “Server”, with Local being the default. I could not find a way to switch a workspace from Local to Server or vice versa, so you’d need a new workspace if you want to change the mode.
Once you start making file changes in your local workspace, you can compare against your workspace version, undo checkout, and other version control operations, even if you are disconnected.
So internally, how does this work?
On your file system, at the root level of your workspace, a hidden folder named $tf is created:
Inside of that folder, TFS caches your workspace version and manages all the changes that will be sent to the server. It’s similar to what SVN does, but it doesn’t have hidden folders all over the place, just one at the root.
Digging into $tf:
And digging further:
So there you go…Local Workspaces!
You can visit Brian Harry’s blog for additional reading on this: http://blogs.msdn.com/b/bharry/archive/2011/08/02/version-control-model-enhancements-in-tfs-11.aspx