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


C# VersionControlServer.CreateWorkspace方法代码示例

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


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

示例1: FixtureSetUp

        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"));
        }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:29,代码来源:WorkspaceTest2.cs

示例2: 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

示例3: 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

示例4: GetWorkspace

        private static Workspace GetWorkspace(string rootFolder, VersionControlServer versionControlServer, string workspaceName, string workingDirectory)
        {
            TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Getting Workspace:{0} RootFolder:{1}", workspaceName,rootFolder);
            Workspace workspace = versionControlServer.CreateWorkspace(workspaceName, versionControlServer.AuthenticatedUser);

            workspace.Map(rootFolder, workingDirectory);
            return workspace;
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:8,代码来源:SourceCodeControlHelper.cs

示例5: FixtureSetUp

        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);
        }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:34,代码来源:Workstation.cs

示例6: 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

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