Created
July 16, 2010 22:29
-
-
Save dieseltravis/479010 to your computer and use it in GitHub Desktop.
.net console apps that get a list of files changed by me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| //Microsoft.TeamFoundation.Client.dll | |
| using Microsoft.TeamFoundation.Client; | |
| //Microsoft.TeamFoundation.VersionControl.Client.dll | |
| using Microsoft.TeamFoundation.VersionControl.Client; | |
| namespace GetPendingChanges | |
| { | |
| class Program | |
| { | |
| const string TFSSERVER = "http://TfsServer:8080"; | |
| static void Main(string[] args) | |
| { | |
| string projectName = args[0]; | |
| TeamFoundationServer tfs = new TeamFoundationServer(TFSSERVER); | |
| VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); | |
| PendingSet[] sets = versionControl.GetPendingSets(new String[] { "$/Projects/" + projectName }, RecursionType.Full); | |
| Console.WriteLine(versionControl.AuthenticatedUser + " pending changes for " + projectName + ":"); | |
| int total = 0; | |
| foreach (PendingSet set in sets) | |
| { | |
| if (set.Type == PendingSetType.Workspace && set.OwnerName == versionControl.AuthenticatedUser) | |
| { | |
| foreach (PendingChange pc in set.PendingChanges) | |
| { | |
| Console.WriteLine(pc.ServerItem); | |
| total++; | |
| } | |
| } | |
| } | |
| Console.WriteLine(total.ToString() + " total changes."); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| //Microsoft.VisualStudio.SourceSafe.Interop.dll | |
| using Microsoft.VisualStudio.SourceSafe.Interop; | |
| namespace GetPendingCheckins | |
| { | |
| class Program | |
| { | |
| const string SSDIR = @"\\VssServer\VssShare"; | |
| static void Main(string[] args) | |
| { | |
| string projectName = args[0]; | |
| string userName = "user"; | |
| string vssPath = SSDIR; | |
| VSSDatabaseClass vss = new VSSDatabaseClass(); | |
| vss.Open(vssPath + @"\srcsafe.ini", userName, userName); | |
| VSSItem sourceItem = vss.get_VSSItem("$/Projects/" + projectName, false); | |
| Console.WriteLine(userName + " pending checkins for " + projectName + ":"); | |
| int total = GetItems(sourceItem); | |
| Console.WriteLine(total.ToString() + " total changes."); | |
| } | |
| const int VSSFILE_CHECKEDOUT_ME = 2; | |
| const int VSSITEM_PROJECT = 0; | |
| const int VSSITEM_FILE = 1; | |
| public static int GetItems(IVSSItem originalItem) | |
| { | |
| int total = 0; | |
| foreach (IVSSItem subItem in originalItem.get_Items(false)) | |
| { | |
| if (subItem.Type == VSSITEM_FILE && subItem.IsCheckedOut == VSSFILE_CHECKEDOUT_ME) | |
| { | |
| Console.WriteLine(subItem.Spec); | |
| total++; | |
| } | |
| else if (subItem.Type == VSSITEM_PROJECT) | |
| { | |
| total += GetItems(subItem); | |
| } | |
| } | |
| return total; | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the compiled EXEs to your External Tools in VS, pass in $(TargetName) and/or Prompt for arguments and send it to the Output window.