|
|||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
OverviewTeam Foundation Version Control (TFVC) has the most common functionalities for version control systems (e.g.:. SourceSafe, Source Gear, CVS, Subversion, etc.) like management of file versions, management of users and permissions associated with the source code, or creating branches inside a project. TFVC also introduces new features such as "shelving and unshelving changes", "Check-in policies", and "exclusive or shared check out" (more info: MSDN). Working with TFVC, you will be involved in many tasks such as: managing workspaces, setting user permissions, looking for who leaves files locked, comparing files history, destroying version control files/folders from TFS, etc. Some of these features are only available through command-line, and because of this, at the end of the day, you may write a lot command lines. This is where the "Team Foundation Sidekicks" tool comes into play. Searching in the web for a graphical tool to handle most of these common tasks mentioned above, I found a site which describes one of its products as "a suite of tools for Microsoft Team Foundation Server administrators and advanced users, providing a Graphical User Interface for administrative and advanced version control tasks in multi-user TFS environments". And, the best part about it is that it is a freeware suite, and it may be used for commercial or noncommercial purposes under this license. So, I created a test project inside TFS, and I started to evaluate all the product features, see more info here. After a playing with it for a while, I found a lot of cool functionalities, but the one that caught my attention was a menu item labeled "Add Sidekick..". And, I thought, maybe I can write my own TFS sidekick and plug it into this tool. The problemSometimes, I need to permanently delete files/folders from TFVC (destroy files/folders) due to disk space requirements; I remove projects that might be created for testing purposes, etc. This feature is only available through the command-line interface. It depends on how deep the files/folders are inside the project structure. I may end up writing a long path to achieve my objective. So, it would be great to have a file explorer (similar to Windows Explorer for file systems) that would allow me to destroy files/folders I don't need. Let's try to create a user friendly interface for "destroying" files/folders from TFVC. Building your own Team Foundation SidekickThe first thing you need to do is to download and install the Team Foundation Sidekick tool (Team Explorer 2005 or 2008 must be installed on a computer in order to run the application, see implementation notes). Once you have installed Team Explorer and Team Foundation Sidekick, you'll have the API for extending the Team Foundation Version Control features. The Team Foundation Sidekicks controls must inherit from the namespace MySidekick.Control
{
public partial class DestroyFilesAndFoldersViewControl : BaseSidekickControl
{
DestroyFilesAndFoldersController _controller = null;
public DestroyFilesAndFoldersViewControl()
{
InitializeComponent();
base.Name = "Destroy Sidekick";
}
public override Image Image
{
get
{
return new Bitmap(@"c:\Test\Resources\Destroy.bmp");
}
}
}
}
It is also recommended that we create a " namespace MySidekick.Controller
{
public class DestroyFilesAndFoldersController : TfsController
{
public DestroyFilesAndFoldersController(TfsController
baseController) : base(baseController)
{
}
}
}
Then, we need to override the namespace MySidekick.Control
{
public partial class DestroyFilesAndFoldersViewControl :
BaseSidekickControl
{
DestroyFilesAndFoldersController _controller = null;
public DestroyFilesAndFoldersViewControl()
{
InitializeComponent();
base.Name = "Destroy Sidekick";
}
public override Image Image
{
get
{
return new Bitmap(@"c:\Test\Resources\Destroy.bmp");
}
}
public override void Initialize(TfsController controller)
{
this._controller = new DestroyFilesAndFoldersController(controller);
}
}
}
At this point, we only have to write the method that actually destroys the files/folders from TFVC. If we explore the public Item[] Destroy(ItemSpec itemSpec, VersionSpec versionSpec,
VersionSpec stopAt, DestroyFlags flags);
But, in the SDK Reference for Team Foundation Server, there is no information about the public ItemSpec(string item, RecursionType recursionType, int deletionId);
Here, Once we can create an instance of the public ItemSpec GetItemsSpec(string path, int deletionID)
{
return new ItemSpec( path, RecursionType.Full, deletionID);
}
all we have to do is call the public void Destroy(string path, int deletionID)
{
base.VersionControl.Destroy(GetItemsSpec(path, deletionID),
VersionSpec.Latest, null, DestroyFlags.None);
}
More information about the Then, we just need to compile the control to build the assembly that we will load into the Team Foundation Sidekick frame using the "Add Sidekick.." menu item.
And, as you can see in the image below, we have a new menu item labeled "Destroy Sidekick".
Clicking on it, we will see the following screen. And now, we only have to search for the files/folders that we want to remove, and press Delete in the keyboard.
That's all, I hope you enjoyed this article.
|
||||||||||||||||||||||||||||||||||||||||