当前位置: 首页>>代码示例>>C#>>正文


C# VersionControlServer.QueryWorkspaces方法代码示例

本文整理汇总了C#中Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.QueryWorkspaces方法的典型用法代码示例。如果您正苦于以下问题:C# VersionControlServer.QueryWorkspaces方法的具体用法?C# VersionControlServer.QueryWorkspaces怎么用?C# VersionControlServer.QueryWorkspaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer的用法示例。


在下文中一共展示了VersionControlServer.QueryWorkspaces方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWorkspaceByName

        public Workspace GetWorkspaceByName(string workspaceName, VersionControlServer sourceControl)
        {
            Workspace MyWorkspace = null;

            if (String.IsNullOrEmpty(workspaceName))
            {
                throw new BuildException("Unable to determine Workspace to use as both the WorkspaceName and LocalItem are not set.");
            }

            Workspace[] Workspaces = sourceControl.QueryWorkspaces(workspaceName, sourceControl.AuthenticatedUser, Workstation.Current.Name);
            if (Workspaces.Length > 0)
                MyWorkspace = Workspaces[0];

            return MyWorkspace;
        }
开发者ID:vardars,项目名称:ci-factory,代码行数:15,代码来源:WorkspaceAssistant.cs

示例2: GetLatestVerstion

 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();
         }
     }
 }
开发者ID:RKishore222,项目名称:TestProject,代码行数:23,代码来源:GetLatestCodeFromTFS.cs

示例3: GetMappedWorkspace

        /// <summary>
        /// Gets a TFS workspace mapped to the specified target path (i.e. generally the /SRC temporary directory)
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="targetPath">The target path.</param>
        private Workspace GetMappedWorkspace(VersionControlServer server, string sourcePath, string targetPath)
        {
            string workspaceName = "BuildMaster" + Guid.NewGuid().ToString().Replace("-", "");

            var workspaces = server.QueryWorkspaces(workspaceName, server.AuthorizedUser, Environment.MachineName);
            var workspace = workspaces.SingleOrDefault(ws => ws.Name == workspaceName);
            if (workspace != null)
            {
                workspace.Delete();
            }

            workspace = server.CreateWorkspace(workspaceName);

            workspace.CreateMapping(new WorkingFolder(sourcePath, targetPath));

            if (!workspace.HasReadPermission)
            {
                throw new SecurityException(String.Format("{0} does not have read permission for {1}", server.AuthorizedUser, targetPath));
            }

            return workspace;
        }
开发者ID:mwpnl,项目名称:bmx-tfs2012,代码行数:28,代码来源:TfsSourceControlProvider.cs

示例4: RemoveWorkspace

 private static void RemoveWorkspace(string workspaceName, VersionControlServer server)
 {
     TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Removing Workspace{0}", workspaceName);
     if (server.QueryWorkspaces(workspaceName, server.AuthenticatedUser, Environment.MachineName).Length > 0)
     {
         server.DeleteWorkspace(workspaceName, server.AuthenticatedUser);
     }
 }
开发者ID:hopenbr,项目名称:HopDev,代码行数:8,代码来源:SourceCodeControlHelper.cs

示例5: GetMappedWorkspace

        /// <summary>
        /// Gets a TFS workspace mapped to the specified target path
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="targetPath">The target path.</param>
        private Workspace GetMappedWorkspace(VersionControlServer server, TfsSourceControlContext context)
        {
            var workspaces = server.QueryWorkspaces(context.WorkspaceName, server.AuthorizedUser, Environment.MachineName);
            var workspace = workspaces.FirstOrDefault();
            if (workspace == null) 
        {
                this.LogDebug("Existing workspace not found, creating workspace \"{0}\"...", context.WorkspaceName);
                workspace = server.CreateWorkspace(context.WorkspaceName);
            }
            else 
            {
                this.LogDebug("Workspace found: " + workspace.Name);
            }

            this.LogDebug("Workspace mappings: \r\n" + string.Join(Environment.NewLine, workspace.Folders.Select(m => m.LocalItem + "\t->\t" + m.ServerItem)));

            if (!workspace.IsLocalPathMapped(context.WorkspaceDiskPath))
            {
                this.LogDebug("Local path is not mapped, creating mapping to \"{0}\"...", context.WorkspaceDiskPath);
                this.DeleteWorkspace(context);
                workspace.Map(context.SourcePath, context.WorkspaceDiskPath);
            }

            if (!workspace.HasReadPermission)
                throw new System.Security.SecurityException(string.Format("{0} does not have read permission for {1}", server.AuthorizedUser, context.WorkspaceDiskPath));

            return workspace;
        }
开发者ID:mwpnl,项目名称:bmx-tfs,代码行数:34,代码来源:TfsSourceControlProvider.cs

示例6: UpdateWorkspaceInfoCache

        public void UpdateWorkspaceInfoCache(VersionControlServer versionControl,
																				 string ownerName)
        {
            InternalServerInfo[] serverInfos = ReadCachedWorkspaceInfo();
            XmlElement servers = InitWorkspaceInfoCache();

            Workspace[] workspaces = versionControl.QueryWorkspaces(null, ownerName, Name);
            InternalServerInfo newServerInfo = new InternalServerInfo(versionControl.Uri.ToString(), versionControl.ServerGuid, workspaces);

            bool found = false;
            foreach (InternalServerInfo sInfo in serverInfos)
                {
                    InternalServerInfo finalInfo = sInfo;
                    if (sInfo.Uri == versionControl.Uri)
                        {
                            finalInfo = newServerInfo;
                            found = true;
                        }

                    XmlElement serverInfoElement = finalInfo.ToXml(servers.OwnerDocument);
                    servers.AppendChild(serverInfoElement);
                }

            if (!found)
                {
                    XmlElement serverInfoElement = newServerInfo.ToXml(servers.OwnerDocument);
                    servers.AppendChild(serverInfoElement);
                }

            SaveWorkspaceInfoCache(servers.OwnerDocument);
        }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:31,代码来源:Workstation.cs

示例7: InitTfsWorkspace

        private void InitTfsWorkspace()
        {
            tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(RegisteredTfsConnections.GetProjectCollections().Single());
            versionControlServer = tfsCollection.GetService<VersionControlServer>();

            userName = tfsCollection.AuthorizedIdentity.UniqueName;

            workspace = versionControlServer.QueryWorkspaces(null, null, System.Environment.MachineName).Single();
            workingFolders = workspace.Folders.Where(f => !f.IsCloaked).ToList();

            tfsProjects = new List<TeamProject>();
            folderByProject = new Dictionary<TeamProject, WorkingFolder>();
            foreach (var folder in workingFolders)
            {
                var project = workspace.GetTeamProjectForLocalPath(folder.LocalItem);
                if (!folderByProject.ContainsKey(project))
                {
                    tfsProjects.Add(project);
                    folderByProject.Add(project, folder);
                }
            }

            ProjectsCombo.ItemsSource = tfsProjects;
            allBranches = versionControlServer.QueryRootBranchObjects(RecursionType.Full);
        }
开发者ID:mareek,项目名称:TFSToolBox,代码行数:25,代码来源:MainWindow.xaml.cs

示例8: SetupWorkspace

        private void SetupWorkspace(string workingDirectory, string cpSourceBranch, VersionControlServer versionControl)
        {
            List<WorkingFolder> workingFolders = new List<WorkingFolder>();
            workingFolders.Add(new WorkingFolder(cpSourceBranch, workingDirectory));

            // Create a workspace.
            Workspace[] workspaces = versionControl.QueryWorkspaces(sourcePuller.WorkspaceName, versionControl.AuthorizedUser, Environment.MachineName);

            if (workspaces.Length > 0)
                versionControl.DeleteWorkspace(sourcePuller.WorkspaceName, versionControl.AuthorizedUser);

            workspace = versionControl.CreateWorkspace(sourcePuller.WorkspaceName, versionControl.AuthorizedUser, "Work for GetTFSSourceUtil tool", workingFolders.ToArray(), Environment.MachineName);
        }
开发者ID:sushibobdavis,项目名称:GetTFSSourceUtil,代码行数:13,代码来源:SourcePullerManager.cs


注:本文中的Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.QueryWorkspaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。