1. TFS 2008不直接提供对WorkItem的删除支持,但其提供了另外的tools来支持对WorkItem的删除其实本质上也就是对数据库的记录的删除操作,但鉴于大家对TFS Database的结构不是很熟悉,所以还是建议下载Visual Studio Team System 2008 Team Foundation Server Power Tools来实现对WorkItem的删除-命令行操作。

下载地址: http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx (这个页面也提供了一些对命令参数的解释)

一旦你安装了TFS Power Tools,那么事情会变得很简单。直接在命令行下运行TFPT.exe即可。

tfpt destroywi - Destroy one or more work items

Destroys a work item or work items.  Currently, work items can
only be destroyed.  Destroying a work item means the work items
is physically deleted and cannot be restored.  The system does
not support logical (and thus recoverable) deletion of work items.
Destroyed work items will remain in the data warehouse.

Usage: tfpt destroywi /server:tfsservername /workitemid:value1[,value2,...] [/noprompt]

 /server                Required. TFS server.
 /workitemid            Required. IDs of work items to destroy.
 /noprompt              If specified, does not ask for confirmation before destroying.

例如: (假设Power Tools的安装目录为默认的安装目录)

C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\TFPT /destroywi /server:192.168.0.10 /workitemid:4689

TFS Power Tools Command List:

C:\Program Files (x86)\Microsoft Team Foundation Server 2008 Power Tools>tfpt uu /?
TFPT - Team Foundation Power Tools 2008 (December 2007 release)

Type tfpt help <command name> for full description

Commands:
tfpt annotate           Display line-by-line change information for a file
tfpt bind               Convert VSS-bound solutions into TFS-bound solutions
tfpt destroywi          Destroy one or more work items
tfpt destroywitd                Destroy a work item type and its work item
tfpt getcs              Get only the changes in a particular changeset
tfpt history            Show the history of an item
tfpt online             Pend adds, edits, deletes to writable files
tfpt query              Query for work items
tfpt review             Review (diff/view) workspace changes
tfpt rollback           Pend changes to roll back a changeset
tfpt treeclean          Delete files that are not under version control
tfpt tweakui            Enhance how client connects to Team Foundation Server
tfpt unshelve           Unshelve into workspace with pending changes
tfpt uu                 Undo changes to unchanged files in the workspace
tfpt workitem           Create, update, or view work items
tfpt workspace          Update a workspace

2. 如何UNDO别人正在独占迁出的文件?

    有时候某些文件被别的同事由于某种原因独占迁出,而当我们需要更改部分代码的时候就无法更改。这个时候我们如果迫切需要更改,那么可以选择先undo掉别人的更改并把文件迁入服务器,这样我们就可以迁出更改了。当然,做这个工作的时候得十分小心,否则别人的工作会有可能无法再恢复。

TFS内置的命令行(Team Foundation Version Control Tool)就可以帮我们完成这个任务:tf undo.下边是这个命令的详细参数: 

Removes pending changes from a workspace.

tf undo [/workspace:workspacename[;workspaceowner]] [/server:servername] [/recursive] itemspec [/noprompt]

 例如:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>tf undo /workspace:Computer;DOMAIN\DomainAccount/server:192.168.0.10 $/Project/trunk/App.config
一旦上边的命令被执行成功,你将会得到一下提示:

The operation completed successfully.  Because the workspace Computer;DomainAccount is not on this computer, you must perform a separate get operation in that works pace to update it with the changes that have been made on the server.

在上边的命令里,我们需要做部分说明:

  • /workspace:workspacename[;workspaceowner]] 这个是指已经迁出这个文件的机器名,后边的workspaceowner是指在这台机器上迁出这个文件的域用户
  • itemspec: 指你想要恢复的文件路径。$是指Source Control的根目录

Team Foundation Version Control Tool是TFS自带的,你需要运行在Visual Studio 2008 command prompt里。tf还提供了很多的功能,例如:

 

tf add         Adds new files and folders from a local file system location to Team Foundation version control.

tf branch      Copies an item or set of items, including metadata and version control history, from one location to another on the Team Foundation version control server and in the local workspace.

tf branches    Displays the history of a branch for a specified file or folder

tf changeset   Displays information about a changeset and lets you change the associated attributes, such as comments and check-in notes.

tf checkin     Commits pending changes in the current workspace to Team Foundation version control.

tf checkout    Makes the local file writable and changes its pending Change status to "edit" in the workspace. Edit is an alias for the Checkout command.

tf configure   Enables an administrator to view and change the following configuration settings for a team project in the Source Control Settings dialog box:
               - Check-out settings
               - Check-in policies
               - Check-in notes

tf delete      Removes files and folders from Team Foundation version control and deletes them from the disk.

tf destroy     Destroys, or permanently deletes, version-controlled files from Team Foundation version control.

tf diff        Compares, and if it is possible, displays differences between two files, files in two folders, or a shelveset and a local or server file.

tf dir         Displays all or part of the contents of Team Foundation version control.

tf folderdiff  Display a visual representation of the differences between file in two server folders, in a server folder and a local folder, or in two local folders.

tf get         Retrieves a read-only copy of a file from Team Foundation Server to the workspace and creates folders on disk to contain it.

tf help        Displays a help topic to the command-line that contains detaile information about a Team Foundation command.

tf history     Displays the revision history for one or more files and folders

tf label       Attaches a label to or removes a label from a version of a file or folder in Team Foundation version control.

tf labels      Displays the list of labels in Team Foundation version control.

tf lock        Locks or unlocks a file or folder to deny or restore the permissions of users to check out an item for edit into a different workspace or to check in pending changes to an item from a different workspace.

tf merge       Applies changes from one branch into another.

tf merges      Displays detailed information about past merges between the specified source and destination branches.

tf msdn        Launches the Microsoft Document Explorer to the documentation page for the command.

tf permission  Modifies the user access control list (ACL) and displays authorization settings for an item under version control.

tf properties  Displays information about items under version control.

tf rename      Changes the name or the path of a file or folder. You can use the rename command or the alias move, to move a file or folder to a new location.

tf resolve     Resolves conflicts between changed items in your workspace and the latest or destination versions of items on the server.

tf shelve      Stores a set of pending changes, together with pending check-in notes, a comment, and a list of associated work items in Team Foundation Server without actually checking them into the version control server.

tf shelvesets  Displays information about pending changes to items in one or more workspaces.

tf status      Displays information about pending changes to items in one or more workspaces.

tf undelete    Restores items that were previously deleted.

tf undo        Removes pending changes from a workspace.

tf unlabel     Removes an item from an existing label in Team Foundation version control.

tf unshelve    Restores shelved file revisions, check-in notes, comments, and work item associations to the current workspace or removes an existing shelveset from the server.

tf view        Retrieves a specific version of a file to a temporary folder on your computer and displays it.

tf workfold    Creates, modifies, or displays information about the mappings between your workspace folders and the Team Foundation version control folders.

tf workspace   Creates, deletes, displays, or modifies properties and mappings associated with a workspace.

tf workspaces  Displays information about workspaces in the system and updates cached information about a user name or computer name change on Team Foundation Server.

 

 

posted on 2008-09-27 15:44  Allan.  阅读(3609)  评论(6编辑  收藏  举报