public int GetLatestChangeSetIdFromPath(TfsServerConnection serverConnection, string path) { IEnumerable Enumerable = serverConnection.SourceControl.QueryHistory(path, VersionSpec.Latest, 0, RecursionType.Full, null, null, null, 1, false, false); IEnumerator Enumerator = Enumerable.GetEnumerator(); bool Exists = Enumerator.MoveNext(); if (Exists) return ((Changeset)Enumerator.Current).ChangesetId; return 0; }
public Workspace GetLocalWorkspace(string localItem, TfsServerConnection serverConnection) { Workspace MyWorkspace; if (!Workstation.Current.IsMapped(localItem)) throw new BuildException(String.Format("Unable to determine the Workspace to use, the path {0} does not map to a workspace.", localItem)); WorkspaceInfo MyWorkSpaceInfo = Workstation.Current.GetLocalWorkspaceInfo(localItem); MyWorkspace = MyWorkSpaceInfo.GetWorkspace(serverConnection.TFS); return MyWorkspace; }
public Workspace GetWorkspace(string workspaceName, string localItem, TfsServerConnection serverConnection) { Workspace MyWorkspace = null; if (String.IsNullOrEmpty(workspaceName) && String.IsNullOrEmpty(localItem)) throw new BuildException("Unable to determine Workspace to use as both the WorkspaceName and LocalItem are not set."); if (!String.IsNullOrEmpty(workspaceName)) MyWorkspace = this.GetWorkspaceByName(workspaceName, serverConnection.SourceControl); if (MyWorkspace == null && !String.IsNullOrEmpty(localItem)) MyWorkspace = this.GetLocalWorkspace(localItem, serverConnection); if (MyWorkspace == null) throw new BuildException(String.Format("Unable to determine Workspace to use: WorkspaceName is set to {0} and LocalItem is set to {1}.", workspaceName, localItem)); return MyWorkspace; }
private bool WorkspaceExists(string workspaceName, TfsServerConnection ServerConnection) { bool Result = false; Workspace[] Workspaces = ServerConnection.SourceControl.QueryWorkspaces(workspaceName, ServerConnection.SourceControl.AuthenticatedUser, Workstation.Current.Name); if (Workspaces.Length > 0) Result = true; return Result; }
private bool LabelExists(string label, string scope, TfsServerConnection ServerConnection) { VersionControlLabel[] Labels = ServerConnection.SourceControl.QueryLabels(label, scope, null, true); bool Result; Result = Labels.Length > 0; return Result; }
private string GetWorkSpaceName(string path, TfsServerConnection serverConnection) { WorkspaceInfo Info = Workstation.Current.GetLocalWorkspaceInfo(path); string Name; Name = Info.Name; return Name; }
public int GetLatestChangeSetId(TfsServerConnection serverConnection) { return serverConnection.SourceControl.GetLatestChangesetId(); }