private void GetCodeByChangeSet(VersionControlServer versionControl, TfsGetCodeParams objTfsGetCodeParams) { foreach (var changeSetId in objTfsGetCodeParams.ChangeSetNumbers) { Changeset changeSets = versionControl.GetChangeset(changeSetId); foreach (var changeSetItem in changeSets.Changes) { Item citem = changeSetItem.Item; } } }
public string LatestVersion(TfsGetCodeParams objTfsGetCodeParams) { TfsTeamProjectCollection TFSProjectCollection = null; string status = ""; try { TFSProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(objTfsGetCodeParams.TFSAddress)); var versionControl = TFSProjectCollection.GetService<VersionControlServer>(); // VersionSpec versionFrom = ChangeDateFormate(dateTimePicker1.Value); // VersionSpec versionTo = ChangeDateFormate(dateTimePicker2.Value); TeamProject tp = versionControl.GetTeamProject(objTfsGetCodeParams.ProjectName); //"PaymentPlan2.0_P1"); switch (objTfsGetCodeParams.TFSGetCodeType) { case GetCodeType.LatestVersion: status = GetLatestVerstion(versionControl, objTfsGetCodeParams); break; case GetCodeType.GetSpecificVersion: break; case GetCodeType.Changeset: break; case GetCodeType.ByLabel: break; case GetCodeType.ByDates: break; default: break; } return status; } catch (AuthorizationException ex) { return "Unable to Login to TFS."; } catch (Exception ex) { return ex.Message; } }
private void GetCodeByLabling(VersionControlServer versionControl, TfsGetCodeParams objTfsGetCodeParams) { }
private void GetCodeByDatesRange(VersionControlServer versionControl, TfsGetCodeParams objTfsGetCodeParams) { }
private void GetSpecificVersion(VersionControlServer versionControl, TfsGetCodeParams objTfsGetCodeParams) { }
private string GetLatestVerstion(VersionControlServer versionControl, TfsGetCodeParams objTfsGetCodeParams) { Workspace[] workspaces = versionControl.QueryWorkspaces(objTfsGetCodeParams.WorkStationName, versionControl.AuthenticatedUser, Workstation.Current.Name); if (workspaces.Length > 0) { versionControl.DeleteWorkspace(objTfsGetCodeParams.WorkStationName, versionControl.AuthenticatedUser); } Workspace workspace = versionControl.CreateWorkspace(objTfsGetCodeParams.WorkStationName, versionControl.AuthenticatedUser, "Temporary Workspace"); try { workspace.Map(objTfsGetCodeParams.SourcePath, objTfsGetCodeParams.TargetPath+"/"+objTfsGetCodeParams.BuildVersion ); GetRequest request = new GetRequest(new ItemSpec(objTfsGetCodeParams.SourcePath, RecursionType.Full), VersionSpec.Latest); GetStatus status = workspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite); // this line doesn't do anything - no failures or errors return "done"; } finally { if (workspace != null) { workspace.Delete(); } } }
public string LatestVersion(TfsGetCodeParams objTfsGetCodeParams) { throw new NotImplementedException(); }
private static string GetCodeFromTFS() { TfsGetCodeParams objTfsGetCodeParams = new TfsGetCodeParams(); ProjectDetails _project = _repository.GetProjectDetails(1); objTfsGetCodeParams.TFSAddress = _project.VersionControl.Address; //"https://northalley.visualstudio.com/defaultcollection"; objTfsGetCodeParams.ProjectName = _project.ProjectName;//"PaymentPlan2.0_P1"; objTfsGetCodeParams.SourcePath = _project.SourcePath;// @"$/PaymentPlan2.0_P1/MyAccount"; objTfsGetCodeParams.TargetPath = _project.TargetPath;//@"D:/Test/TFSTest"; objTfsGetCodeParams.WorkStationName = "test"; objTfsGetCodeParams.TFSGetCodeType = GetCodeType.LatestVersion; GetLatestCodeFromTFS objGetLatestCode = new GetLatestCodeFromTFS(); return objGetLatestCode.LatestVersion(objTfsGetCodeParams); }