Visual Studio TFS Worksapce的简单理解

2024-02-15 17:48

本文主要是介绍Visual Studio TFS Worksapce的简单理解,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用Visual Stuido TFS,就使用到了Workspace,或许很多人没有注意到,但是确实是在用。 下边是一片对于workspace基础概念描述很好的文章. 

One of the concepts that people need to understand when they begin to work with Team Foundation Server Version Control is that of the Team Foundation Server (TFS) Workspace. So I thought I would write a series of blog-posts covering the basics of TFS workspaces, with this post being the first. This information may be a little basic to many of the people who read my blog (especially this first post) and it is just a write up of how I think about workspaces and how I explain the concept to others. If you have any additional information to add or comments to make then please do.  Also, if you are new to TFS then you probably want to take a read of the help documentation over at MSDN and in the Teamprise User Guide as there is some great information there on this topic.

Ok.  One of the first problems people have with workspaces is that the term is a little overloaded – this is especially true to users of the Teamprise plug-in for Eclipse as an Eclipse “Workspace” is an entirely different entity that, though related, has very different functions to the TFS workspace.

Conceptually, I like to think of a TFS workspace as a container that bridges the gap between your local computer (acting as a TFS client) and the server.

A TFS Workspace contains several important bits of information. A workspace is identified by its name and its owner. The workspace name can be up to 64 characters in length, and the name must be unique for a given owner. The workspace also contains the hostname of the computer that the workspace is associated with and there is room for you to give your workspace a comment (a good idea when you have multiple workspaces so you can remind yourself what they are for). A workspace also contains the working folder mappings – the links between your computer’s hard drive and the TFS version control repository. You can also picture the workspace as the way in which the TFS server keeps track of which files you have downloaded, what versions of those files you have and which ones you have pending changes and / or locks against in your local file system.

By using workspaces to remember files and versions downloaded TFS can use this information to massively optimize the network traffic between your computer and the TFS server. When you ask the server to “Get Latest”, it already knows what versions you have of everything so it can simply send you what has changed. This is one of the design decisions that the team at Microsoft took to optimized for distributed teams working over wide area networks. The TFS workspaces is therefore a central piece in ensuring two of the key principles in the way TFS Version Control behaves:-

  • Only send the information between server and client that you need to send
  • Only do this when I tell you to

However, to get the benefit of this reduced network traffic, you have one very important price to pay.

  • Talk to TFS when you do something to a file or folder that is in version control

TFS does some neat tricks with workspaces to keep them up-to-date. If somebody renames a file in source control then your local file gets renamed when you do a “Get Latest”. If someone deletes a file, then your local copy gets deleted when you do the “Get”. This way, you are not left with old stale files on your local hard drive like you do when using VSS or CVS etc.

Speaking of "Get Latest", when you do a “Get Latest” a few things happen. Any versions of files that you do not yet have are downloaded and placed into the directories you told it to put them in when you created a working folder mapping. Those files are then marked as read-only in the local file system. To edit a file, you must check the file out.

Check out behaviour diagram

When you do a check out, what you are actually doing is saying “TFS, I would like to edit the version of the file that I have already downloaded, is that ok?” TFS then looks at that version, and tells you if you can edit it or not (based on your security permissions at that point in time and if anyone else has placed a lock on the file). If you can edit the file, the TFS marks the file as read/write on your local machine and allows you to proceed.

When you have finished editing, you check-in the file. Before the code is committed to the server, the server looks at what version you had locally (by looking in your workspace) and compares this with the latest version on the server. If someone else has edited that file since the last time you did a “Get Latest” into your workspace then the server will ask you what to do with that conflicting edit.

Once you get to the position that you have no conflicts in the list of pending changes that you wish to commit, you can then check-in your code and it will get committed to the source code repository as a new changeset.  The server also updates its record of your workspace to say that you already have this new version of the file locally.

In summary, TFS workspaces are the way in which the server can keep track of which versions of what files you have on a given machine, where you have them on that machine and what changes you are in the process of making. 

Hopefully, you can start to see some implications of the way in which TFS workspaces are used by the server.  For example, if you un-mark a file as read/write, edit it and then do a "Get Latest" on that file then it will not be replaced with the latest version from the server (because you never told the server you were messing with that file so it assumes it you didn't).  In that scenario you would want to use the "Get Specific..." option to force a get of the file - but we'll cover all this type of stuff later on.  That is enough for now. As I say, In future posts we will look in more detail at working folder mappings, things that users frequently do that confuse TFS and how to use TFS workspaces to maximise your productivity helping you to get the best out of the excellent version control facilities provided by TFS.  I hope this post proves useful for someone.


这篇关于Visual Studio TFS Worksapce的简单理解的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/712087

相关文章

认识、理解、分类——acm之搜索

普通搜索方法有两种:1、广度优先搜索;2、深度优先搜索; 更多搜索方法: 3、双向广度优先搜索; 4、启发式搜索(包括A*算法等); 搜索通常会用到的知识点:状态压缩(位压缩,利用hash思想压缩)。

csu 1446 Problem J Modified LCS (扩展欧几里得算法的简单应用)

这是一道扩展欧几里得算法的简单应用题,这题是在湖南多校训练赛中队友ac的一道题,在比赛之后请教了队友,然后自己把它a掉 这也是自己独自做扩展欧几里得算法的题目 题意:把题意转变下就变成了:求d1*x - d2*y = f2 - f1的解,很明显用exgcd来解 下面介绍一下exgcd的一些知识点:求ax + by = c的解 一、首先求ax + by = gcd(a,b)的解 这个

hdu2289(简单二分)

虽说是简单二分,但是我还是wa死了  题意:已知圆台的体积,求高度 首先要知道圆台体积怎么求:设上下底的半径分别为r1,r2,高为h,V = PI*(r1*r1+r1*r2+r2*r2)*h/3 然后以h进行二分 代码如下: #include<iostream>#include<algorithm>#include<cstring>#include<stack>#includ

usaco 1.3 Prime Cryptarithm(简单哈希表暴搜剪枝)

思路: 1. 用一个 hash[ ] 数组存放输入的数字,令 hash[ tmp ]=1 。 2. 一个自定义函数 check( ) ,检查各位是否为输入的数字。 3. 暴搜。第一行数从 100到999,第二行数从 10到99。 4. 剪枝。 代码: /*ID: who jayLANG: C++TASK: crypt1*/#include<stdio.h>bool h

uva 10387 Billiard(简单几何)

题意是一个球从矩形的中点出发,告诉你小球与矩形两条边的碰撞次数与小球回到原点的时间,求小球出发时的角度和小球的速度。 简单的几何问题,小球每与竖边碰撞一次,向右扩展一个相同的矩形;每与横边碰撞一次,向上扩展一个相同的矩形。 可以发现,扩展矩形的路径和在当前矩形中的每一段路径相同,当小球回到出发点时,一条直线的路径刚好经过最后一个扩展矩形的中心点。 最后扩展的路径和横边竖边恰好组成一个直

【生成模型系列(初级)】嵌入(Embedding)方程——自然语言处理的数学灵魂【通俗理解】

【通俗理解】嵌入(Embedding)方程——自然语言处理的数学灵魂 关键词提炼 #嵌入方程 #自然语言处理 #词向量 #机器学习 #神经网络 #向量空间模型 #Siri #Google翻译 #AlexNet 第一节:嵌入方程的类比与核心概念【尽可能通俗】 嵌入方程可以被看作是自然语言处理中的“翻译机”,它将文本中的单词或短语转换成计算机能够理解的数学形式,即向量。 正如翻译机将一种语言

poj 1113 凸包+简单几何计算

题意: 给N个平面上的点,现在要在离点外L米处建城墙,使得城墙把所有点都包含进去且城墙的长度最短。 解析: 韬哥出的某次训练赛上A出的第一道计算几何,算是大水题吧。 用convexhull算法把凸包求出来,然后加加减减就A了。 计算见下图: 好久没玩画图了啊好开心。 代码: #include <iostream>#include <cstdio>#inclu

uva 10130 简单背包

题意: 背包和 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#include <stack>#include <vector>#include <queue>#include <map>

如何在Visual Studio中调试.NET源码

今天偶然在看别人代码时,发现在他的代码里使用了Any判断List<T>是否为空。 我一般的做法是先判断是否为null,再判断Count。 看了一下Count的源码如下: 1 [__DynamicallyInvokable]2 public int Count3 {4 [__DynamicallyInvokable]5 get

【C++高阶】C++类型转换全攻略:深入理解并高效应用

📝个人主页🌹:Eternity._ ⏩收录专栏⏪:C++ “ 登神长阶 ” 🤡往期回顾🤡:C++ 智能指针 🌹🌹期待您的关注 🌹🌹 ❀C++的类型转换 📒1. C语言中的类型转换📚2. C++强制类型转换⛰️static_cast🌞reinterpret_cast⭐const_cast🍁dynamic_cast 📜3. C++强制类型转换的原因📝