static List<int> GetIdsFromHistory(string path, VersionControlServer tfsClient) { if (tfsClient == null) { tfsClient = GetTfsClient(); } IEnumerable submissions = tfsClient.QueryHistory( path, VersionSpec.Latest, 0, RecursionType.None, // Assume that the path is to a file, not a directory null, null, null, Int32.MaxValue, false, false); List<int> ids = new List<int>(); foreach(Changeset cs in submissions) { ids.Add(cs.ChangesetId); } return ids; }
public VersionControlServer(string tfsServerUri, string tfsProject) { var tfsCollection = new TfsTeamProjectCollection(new Uri(tfsServerUri)); _versionControlServer = (tfs.VersionControlServer)tfsCollection.GetService(typeof(tfs.VersionControlServer)); _teamProject = _versionControlServer.GetTeamProject(tfsProject); }
/// <summary> /// Method for processing work items down to the changesets that are related to them /// </summary> /// <param name="wi">Work Item to process</param> /// <param name="outputFile">File to write the dgml to</param> /// <param name="vcs">Version Control Server which contains the changesets</param> public void ProcessWorkItemRelationships(WorkItem[] wi, string outputFile, bool hideReverse, bool groupbyIteration, bool dependencyAnalysis, List<TempLinkType> selectedLinks, VersionControlServer vcs) { string projectName = wi[0].Project.Name; _workItemStubs = new List<WorkItemStub>(); _wis = wi[0].Store; _vcs = vcs; _tms = vcs.TeamProjectCollection.GetService<ITestManagementService>(); _tmp = _tms.GetTeamProject(projectName); _selectedLinks = selectedLinks; //Store options _hideReverse = hideReverse; _groupbyIteration = groupbyIteration; _dependencyAnalysis = dependencyAnalysis; for (int i = 0; i < wi.Length; i++) { ProcessWorkItemCS(wi[i]); } WriteChangesetInfo(outputFile, projectName); }
public static void DiffFiles(VersionControlServer versionControl, IDiffItem source, IDiffItem target, DiffOptions diffOpts, string fileNameForHeader, bool wait) { DiffItemUtil aItem = new DiffItemUtil('a', fileNameForHeader, source.GetFile()); DiffItemUtil bItem = new DiffItemUtil('b', fileNameForHeader, target.GetFile()); StreamWriter stream = diffOpts.StreamWriter; // short circuit for binary file comparisions if (source.GetEncoding() == RepositoryConstants.EncodingBinary && target.GetEncoding() == RepositoryConstants.EncodingBinary) { stream.WriteLine("Binary files {0} and {1} differ", aItem.Name, bItem.Name); return; } WriteHeader(aItem, bItem, diffOpts); // short circuit new files if (aItem.Length == 0) { WriteNewFile(stream, bItem.Lines); return; } Hashtable hashtable = new Hashtable(aItem.Length + bItem.Length); bool ignoreWhiteSpace = (diffOpts.Flags & DiffOptionFlags.IgnoreWhiteSpace) == DiffOptionFlags.IgnoreWhiteSpace; DiffItem[] items = DiffUtil.DiffText(hashtable, aItem.Lines, bItem.Lines, ignoreWhiteSpace, ignoreWhiteSpace, false); WriteUnified(stream, aItem.Lines, bItem.Lines, items); }
public void FixtureSetUp() { tfsUrl = Environment.GetEnvironmentVariable("TFS_URL"); if (String.IsNullOrEmpty(tfsUrl)) { Console.WriteLine("Warning: Environment variable TFS_URL not set."); Console.WriteLine(" Some tests cannot be executed without TFS_URL."); return; } string username = Environment.GetEnvironmentVariable("TFS_USERNAME"); if (String.IsNullOrEmpty(username)) { Console.WriteLine("Warning: No TFS user credentials specified."); return; } credentials = new NetworkCredential(username, Environment.GetEnvironmentVariable("TFS_PASSWORD"), Environment.GetEnvironmentVariable("TFS_DOMAIN")); // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) return; TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); versionControlServer = (VersionControlServer) tfs.GetService(typeof(VersionControlServer)); workspace = versionControlServer.CreateWorkspace("WorkspaceTest", Environment.GetEnvironmentVariable("TFS_USERNAME")); }
public ReviewItemCollectorStrategy(WorkItemStore store, VersionControlServer versionControlServer, IVisualStudioAdapter visualStudioAdapter, IReviewItemFilter filter) { this.store = store; this.versionControlServer = versionControlServer; this.visualStudioAdapter = visualStudioAdapter; this.filter = filter; }
public GettingDialog(VersionControlServer vcs, Workspace workspace, GetRequest[] requests) : base("Progress") { VBox.Spacing = 10; VBox.Add(new Label("Getting files from the server...")); progressBar = new ProgressBar(); VBox.Add(progressBar); fileLabel = new Label(""); VBox.Add(fileLabel); AddCloseButton("Cancel"); DefaultResponse = ResponseType.Cancel; ShowAll(); getLatestList.Clear(); vcs.Getting += MyGettingEventHandler; GetStatus status = workspace.Get(requests, GetOptions.GetAll|GetOptions.Overwrite); foreach (string file in getLatestList) { Console.WriteLine(file); Pulse("Setting permissions: " + file); if (! FileTypeDatabase.ShouldBeExecutable(file)) continue; FileType.MakeExecutable(file); } }
public override void Connect(string serverUri, string remotePath, string localPath, int fromChangeset, string tfsUsername, string tfsPassword, string tfsDomain) { this._serverUri = new Uri(serverUri); this._remotePath = remotePath; this._localPath = localPath; this._startingChangeset = fromChangeset; try { NetworkCredential tfsCredential = new NetworkCredential(tfsUsername, tfsPassword, tfsDomain); //this._teamFoundationServer = new Microsoft.TeamFoundation.Client.TeamFoundationServer(this._serverUri, tfsCredential); this._tfsProjectCollection = new TfsTeamProjectCollection(this._serverUri, tfsCredential); this._versionControlServer = this._tfsProjectCollection.GetService<VersionControlServer>(); } catch (Exception ex) { throw new Exception("Error connecting to TFS", ex); } //clear hooked eventhandlers BeginChangeSet = null; EndChangeSet = null; FileAdded = null; FileEdited = null; FileDeleted = null; FileUndeleted = null; FileBranched = null; FileRenamed = null; FolderAdded = null; FolderDeleted = null; FolderUndeleted = null; FolderBranched = null; FolderRenamed = null; ChangeSetsFound = null; }
public DiffItemVersionedFile(VersionControlServer versionControl, int itemId, int changeset, string displayPath) { this.versionControlServer = versionControl; this.item = versionControl.GetItem(itemId, changeset); this.label = displayPath; }
public SourceControlWrapper(string teamProjectCollectionUrl, string teamProjectName) { this.tpcollection = new TfsTeamProjectCollection(new Uri(teamProjectCollectionUrl)); this.teamProjectName = teamProjectName; this.vcserver = this.tpcollection.GetService<VersionControlServer>(); }
public void FixtureSetUp() { tfsUrl = Environment.GetEnvironmentVariable("TFS_URL"); if (String.IsNullOrEmpty(tfsUrl)) { Console.WriteLine("Warning: Environment variable TFS_URL not set."); Console.WriteLine(" Some tests cannot be executed without TFS_URL."); return; } string username = Environment.GetEnvironmentVariable("TFS_USERNAME"); if (String.IsNullOrEmpty(username)) { Console.WriteLine("Warning: No TFS user credentials specified."); return; } credentials = new NetworkCredential(username, Environment.GetEnvironmentVariable("TFS_PASSWORD"), Environment.GetEnvironmentVariable("TFS_DOMAIN")); // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) return; TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); versionControlServer = (VersionControlServer) tfs.GetService(typeof(VersionControlServer)); WorkingFolder[] folders = new WorkingFolder[1]; string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT")); folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory); workspace = versionControlServer.CreateWorkspace("UpdateWorkspaceInfoCache_Workspace", Environment.GetEnvironmentVariable("TFS_USERNAME"), "My Comment", folders, Environment.MachineName); }
public DiffItemVersionedFile(Item item, VersionSpec versionSpec) { this.versionControlServer = item.VersionControlServer; this.item = item; this.versionSpec = versionSpec; this.label = item.ServerItem; }
public UsersLocator(IGroupSecurityService groupSecurityService, VersionControlServer versionControlServer, TeamProject teamProject, IGroupsLocator groupsLocator) { m_groupSecurityService = groupSecurityService; m_versionControlServer = versionControlServer; m_teamProject = teamProject; m_groupsLocator = groupsLocator; }
public FolderDiffWrapper(string assemblyPath, string srcPath, VersionSpec srcSpec, string targetPath, VersionSpec targetSpec, VersionControlServer server, RecursionType recursion) { _vcControlsAssembly = Assembly.LoadFrom(assemblyPath); //internal FolderDiff(string path1, VersionSpec spec1, string path2, VersionSpec spec2, VersionControlServer server, RecursionType recursion); FolderDiff = AccessPrivateWrapper.FromType(_vcControlsAssembly, FolderDiffTypeName, srcPath, srcSpec, targetPath, targetSpec, server, recursion); SetupTypesFromAssembly(); }
public virtual void Connect() { WorkspaceInfo wi = Workstation.Current.GetLocalWorkspaceInfo(Environment.CurrentDirectory); using (var tfs = new TfsTeamProjectCollection(wi.ServerUri)) { versionControlServer = tfs.GetService<VersionControlServer>(); } }
public ReviewModel() { teamProjectCollectionProvider = IoC.GetInstance<IVisualStudioAdapter>(); var tpc = teamProjectCollectionProvider.GetCurrent(); workItemStore = tpc.GetService<WorkItemStore>(); versionControlServer = tpc.GetService<VersionControlServer>(); }
public ShowChangesetDialog(VersionControlServer vcs, int cid) : base("Changeset " + cid.ToString()) { changesetDiffView = new ChangesetDiffView(vcs, cid); VBox.Add(changesetDiffView); AddCloseButton(); }
public ShowFileDialog(VersionControlServer vcs, string serverItem) : base(serverItem) { fileView = new FileView(vcs, serverItem); VBox.Add(fileView); AddCloseButton(); }
public static ChangesetQueue GetChangesetQueue(string projectPath, VersionControlServer sourceControl) { if (Queues.ContainsKey(projectPath)) return Queues[projectPath]; ChangesetQueue Queue = new ChangesetQueue(projectPath, sourceControl); Queues.Add(projectPath, Queue); return Queue; }
private List<WorkItemStub> _workItemStubs; //Stores the distinct list of all work items to be written to the dgml #endregion Fields #region Constructors public ProcessFullAnalysis(WorkItemStore wis, VersionControlServer vcs, string projectName, string outputFile) { _wis = wis; _vcs = vcs; _tms = vcs.TeamProjectCollection.GetService<ITestManagementService>(); _tmp = _tms.GetTeamProject(projectName); _projectName = projectName; _outputFile = outputFile; }
public ShowChangesetItemsModel(WorkItemSelectionService workItemSelectionService, WorkItemCollector workItemCollector, WorkItemStore workItemStore, VersionControlServer versionControlServer, IVisualStudioAdapter visualStudioAdapter) { this.workItemSelectionService = workItemSelectionService; this.workItemCollector = workItemCollector; this.workItemStore = workItemStore; this.versionControlServer = versionControlServer; this.visualStudioAdapter = visualStudioAdapter; }
public HistoryProvider(VersionControlServer server, string path, VersionSpec version) { FetchChangesets(server, path, version); for (int i = 0; i < PREFETCH_SIZE && i < this.changesets.Count; i++) { Prefetch(i); } }
public Repository(VersionControlServer versionControlServer, Uri url, ICredentials credentials) { this.versionControlServer = versionControlServer; this.Url = String.Format("{0}/{1}", url, "VersionControl/v1.0/Repository.asmx"); this.itemUrl = String.Format("{0}/{1}", url, RepositoryConstants.DownloadUrlSuffix); this.uploadUrl = String.Format("{0}/{1}", url, RepositoryConstants.UploadUrlSuffix); this.Credentials = credentials; }
public AutomatedPostReview(ILog log, Configuration.Configuration config) { this.log = log; this.config = config; api = new ReviewboardApi(new Uri(config.ReviewBoardServer), new NetworkCredential(config.ReviewBoardUserName, config.ReviewBoardPassword)); var teamProjectCollection = new TfsTeamProjectCollection(config.ServerUri); vcs = teamProjectCollection.GetService<VersionControlServer>(); }
public Tfs2010BuildService( IBuildServer buildServer, VersionControlServer versionControlServer, ITestManagementService testManagementService) { this.buildServer = buildServer; this.versionControlServer = versionControlServer; this.testManagementService = testManagementService; }
public MainWindowViewModel() { server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection( RegisteredTfsConnections.GetProjectCollections().First().Uri); workItemStore = (WorkItemStore)server.GetService(typeof(WorkItemStore)); versionControl = server.GetService<VersionControlServer>(); buildServer = (IBuildServer)server.GetService(typeof(IBuildServer)); historyLoader = new HistoryLoader(versionControl); loadHistoryCommand = new DelegateCommand(LoadHistory); }
public TfsClient(string url) { if (String.IsNullOrEmpty(url)) throw new ArgumentNullException(nameof(url)); var credentials = new TfsClientCredentials(); var collection = new TfsTeamProjectCollection(new Uri(url), credentials); m_server = collection.GetService<VersionControlServer>(); }
public ChangesetVisitor(WorkItemStore store, VersionControlServer versionControlServer, IVisualStudioAdapter visualStudioAdapter) { this.versionControlServer = versionControlServer; this.visualStudioAdapter = visualStudioAdapter; workItemVisitor = new WorkItemVisitor(store); workItemVisitor.WorkItemVisit += OnWorkItemVisit; workspace = visualStudioAdapter.GetCurrentWorkSpace(); }
public void UpdateCid(VersionControlServer vcs, int cid) { Clear(); Changeset changeset = vcs.GetChangeset(cid, true, false); foreach (Change change in changeset.Changes) { changesetDetailStore.AppendValues(ChangeTypeToString(change.ChangeType), change.Item.ServerItem); } }
internal Workspace(VersionControlServer versionControlServer, WorkspaceInfo info) : this() { this.versionControlServer = versionControlServer; this.name = info.Name; this.ownerName = info.OwnerName; this.comment = info.Comment; this.folders = new WorkingFolder[0]; this.computer = info.Computer; }
/// <summary>Initialise une nouvelle instance de la classe <see cref="SourceControlProject"/></summary> /// <param name="configuration">The application configuration information.</param> /// <param name="projectId">The project id used to define which configuration will be used.</param> public SourceControlProject(TfsCommitMonitorConfigurationSection configuration, string projectId) { _configuration = configuration; _tfsServer = _configuration.Servers[projectId]; _teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ServerConfiguration.TfsTeamProjectCollection)); _versionControlServer = _teamProjectCollection.GetService<VersionControlServer>(); foreach (MonitoredProjectItemConfigurationElement item in _tfsServer.Folders) _monitoredItems.Add(item.ItemId, item.MonitoredFolder); }
internal TfsBuild2Helper(Uri tpcUrl) { this.connection = new VssConnection(tpcUrl, new VssClientCredentials(true)); this.client = connection.GetClient <TFSWebApi.BuildHttpClient>(); // Connect to tfs server var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tpcUrl); tpc.EnsureAuthenticated(); // Connect to version control service this.versionControl = tpc.GetService <VSClient.VersionControlServer>(); }
public void Workspace_QueryWorkspaces2() { // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); Workspace[] workspaces = vcs.QueryWorkspaces(null, null, Environment.MachineName); foreach (Workspace workspace in workspaces) { Assert.IsNotNull(workspace.Name); } }
public void Item_DownloadFile() { // need TFS_ envvars for this test // this test also assumes the $TFS_PROJECT contains at least one file in // the top level directory which is non-zero in length if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); string itemPath = String.Format("$/{0}/*", Environment.GetEnvironmentVariable("TFS_PROJECT")); ItemSpec itemSpec = new ItemSpec(itemPath, RecursionType.OneLevel); ItemSet itemSet = vcs.GetItems(itemSpec, VersionSpec.Latest, DeletedState.NonDeleted, ItemType.File, true); int i = 0; Item[] items = itemSet.Items; foreach (Item item in items) { if (item.ContentLength == 0) { continue; } i++; string fname = Path.GetTempFileName(); item.DownloadFile(fname); FileInfo fileInfo = new FileInfo(fname); Assert.IsTrue(fileInfo.Length > 0); File.Delete(fname); // limit how many files we pull here if (i == 3) { break; } } }
public void Workspace_TryGetWorkingFolderForServerItem() { // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); WorkingFolder[] folders = new WorkingFolder[2]; string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT")); folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory); string deeper = Path.Combine(Environment.CurrentDirectory, "deeper"); folders[1] = new WorkingFolder(serverItem + "/deeper", deeper); Workspace w1 = vcs.CreateWorkspace("CreateDelete1_Workspace", Environment.GetEnvironmentVariable("TFS_USERNAME"), "My Comment", folders, Environment.MachineName); WorkspaceInfo info = Workstation.Current.GetLocalWorkspaceInfo(Environment.CurrentDirectory); Workspace w2 = info.GetWorkspace(tfs); // this will talk to the server and get the mapped paths w2.RefreshMappings(); { string serverItem1 = String.Format("{0}/deeper/foo.txt", serverItem); WorkingFolder folder = w2.TryGetWorkingFolderForServerItem(serverItem1); Assert.AreEqual(deeper, folder.LocalItem); } { string serverItem1 = String.Format("junk/deeper/foo.txt", serverItem); WorkingFolder folder = w2.TryGetWorkingFolderForServerItem(serverItem1); Assert.IsNull(deeper); } w1.Delete(); }
public void Workspace_GetItems2() { // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); string itemPath = String.Format("$/{0}/*", Environment.GetEnvironmentVariable("TFS_PROJECT")); ItemSet itemSet = vcs.GetItems(itemPath, RecursionType.OneLevel); Item[] items = itemSet.Items; foreach (Item item in items) { Assert.IsNotNull(item.ServerItem); } }
public void Workspace_QueryLabels1() { // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); string path = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT")); VersionControlLabel[] labels = vcs.QueryLabels(null, path, null, false); foreach (VersionControlLabel label in labels) { Assert.IsNotNull(label.Name); } }
public void FixtureSetUp() { tfsUrl = Environment.GetEnvironmentVariable("TFS_URL"); if (String.IsNullOrEmpty(tfsUrl)) { Console.WriteLine("Warning: Environment variable TFS_URL not set."); Console.WriteLine(" Some tests cannot be executed without TFS_URL."); return; } string username = Environment.GetEnvironmentVariable("TFS_USERNAME"); if (String.IsNullOrEmpty(username)) { Console.WriteLine("Warning: No TFS user credentials specified."); return; } credentials = new NetworkCredential(username, Environment.GetEnvironmentVariable("TFS_PASSWORD"), Environment.GetEnvironmentVariable("TFS_DOMAIN")); // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); versionControlServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); WorkingFolder[] folders = new WorkingFolder[1]; string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT")); folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory); workspace = versionControlServer.CreateWorkspace("UpdateWorkspaceInfoCache_Workspace", Environment.GetEnvironmentVariable("TFS_USERNAME"), "My Comment", folders, Environment.MachineName); }
public WorkspaceInfo GetLocalWorkspaceInfo(VersionControlServer versionControl, string workspaceName, string workspaceOwner) { InternalServerInfo[] servers = ReadCachedWorkspaceInfo(); foreach (InternalServerInfo sInfo in servers) { if (sInfo.Uri != versionControl.Uri) { continue; } foreach (WorkspaceInfo info in sInfo.Workspaces) { if (info.Name == workspaceName && info.OwnerName == workspaceOwner) { return(info); } } } return(null); }
public void Workspace_CreateDelete2() { // need TFS_ envvars for this test if (String.IsNullOrEmpty(tfsUrl)) { return; } TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); WorkingFolder[] folders = new WorkingFolder[1]; string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT")); folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory); Workspace w1 = vcs.CreateWorkspace("CreateDelete2_Worspace", Environment.GetEnvironmentVariable("TFS_USERNAME"), "CreateDelete2 Comment", folders, "CreateDelete2_Computer"); w1.Delete(); }
public Program(IBuildDetail[] builds, IEnumerable <string> options, IEnumerable <string> exclusions, WorkItemStore workItemStore, Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer versionControlServer, TestManagementService tms, string selectedProject) { this.Builds = builds; this.NoteOptions = options; this.Exclusions = exclusions; this.WorkItemStore = workItemStore; this.VersionControlServer = versionControlServer; this.TestManagementService = tms; this.SelectedProject = selectedProject; }
public GetStatus Get(GetRequest[] requests, GetOptions options, GetFilterCallback filterCallback, object userData) { bool force = ((GetOptions.Overwrite & options) == GetOptions.Overwrite); bool noGet = false; // not implemented below: ((GetOptions.Preview & options) == GetOptions.Preview); SortedList <int, DateTime> changesetDates = new SortedList <int, DateTime>(); GetOperation[] getOperations = Repository.Get(Name, OwnerName, requests, force, noGet); if (null != filterCallback) { filterCallback(this, getOperations, userData); } UpdateLocalVersionQueue updates = new UpdateLocalVersionQueue(this); foreach (GetOperation getOperation in getOperations) { string uPath = null; GettingEventArgs args = new GettingEventArgs(this, getOperation); // Console.WriteLine(getOperation.ToString()); if (getOperation.DeletionId != 0) { if ((getOperation.ItemType == ItemType.Folder) && (Directory.Exists(getOperation.SourceLocalItem))) { UnsetDirectoryAttributes(getOperation.SourceLocalItem); Directory.Delete(getOperation.SourceLocalItem, true); } else if ((getOperation.ItemType == ItemType.File) && (File.Exists(getOperation.SourceLocalItem))) { UnsetFileAttributes(getOperation.SourceLocalItem); File.Delete(getOperation.SourceLocalItem); } } else if ((!String.IsNullOrEmpty(getOperation.TargetLocalItem)) && (!String.IsNullOrEmpty(getOperation.SourceLocalItem)) && (getOperation.SourceLocalItem != getOperation.TargetLocalItem)) { uPath = getOperation.TargetLocalItem; try { File.Move(getOperation.SourceLocalItem, getOperation.TargetLocalItem); } catch (IOException) { args.Status = OperationStatus.TargetIsDirectory; } } else if (getOperation.ChangeType == ChangeType.None && getOperation.VersionServer != 0) { uPath = getOperation.TargetLocalItem; string directory = uPath; if (getOperation.ItemType == ItemType.File) { directory = Path.GetDirectoryName(uPath); } if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } if (getOperation.ItemType == ItemType.File) { DownloadFile.WriteTo(uPath, Repository, getOperation.ArtifactUri); // ChangesetMtimes functionality : none standard! if (mTimeSetting) { int cid = getOperation.VersionServer; DateTime modDate; if (!changesetDates.TryGetValue(cid, out modDate)) { Changeset changeset = VersionControlServer.GetChangeset(cid); modDate = changeset.CreationDate; changesetDates.Add(cid, modDate); } File.SetLastWriteTime(uPath, modDate); } // do this after setting the last write time! SetFileAttributes(uPath); } } versionControlServer.OnDownloading(args); updates.QueueUpdate(getOperation.ItemId, uPath, getOperation.VersionServer); } updates.Flush(); return(new GetStatus(getOperations.Length)); }
public Workspace GetWorkspace(TeamFoundationServer tfs) { VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); return(vcs.GetWorkspace(Name, OwnerName)); }
internal TfsBranch(VersionControlServer vcs, Microsoft.TeamFoundation.VersionControl.Client.BranchObject branchObject) { _vcs = vcs; BranchObject = branchObject; Name = BranchObject == null ? null : BranchObject.Properties.RootItem.Item; }
internal TfsBranch(VersionControlServer vcs, string name) { _vcs = vcs; Name = name; }
internal TfsBranch(VersionControlServer vcs, string name, bool isSubBranch) { _vcs = vcs; Name = name; _isSubBranch = isSubBranch; }
internal Item(VersionControlServer versionControlServer, string serverItem) { this.versionControlServer = versionControlServer; this.serverItem = serverItem; }