private Workspace GetWorkspace(string localDirectory, string repositoryPath)
 {
     try
     {
         var workspace = VersionControl.CreateWorkspace(GenerateWorkspaceName());
         workspace.CreateMapping(new WorkingFolder(repositoryPath, localDirectory));
         return(workspace);
     }
     catch (MappingConflictException e)
     {
         throw new GitTfsException(e.Message, new[] { "Run 'git tfs cleanup-workspace' to remove the workspace." }, e);
     }
 }
Beispiel #2
0
        private Workspace GetWorkspace(string localDirectory, string repositoryPath)
        {
            var workspace = VersionControl.CreateWorkspace(GenerateWorkspaceName());

            try
            {
                workspace.CreateMapping(new WorkingFolder(repositoryPath, localDirectory));
            }
            catch (MappingConflictException e)
            {
                workspace.Delete();
                throw new GitTfsException(e.Message).WithRecommendation("Run 'git tfs cleanup-workspaces' to remove the workspace.");
            }
            catch
            {
                workspace.Delete();
                throw;
            }
            return(workspace);
        }
        private Workspace GetWorkspace(params WorkingFolder[] folders)
        {
            var workspace = VersionControl.CreateWorkspace(GenerateWorkspaceName());

            try
            {
                foreach (WorkingFolder folder in folders)
                {
                    workspace.CreateMapping(folder);
                }
            }
            catch (MappingConflictException e)
            {
                workspace.Delete();
                throw new GitTfsException(e.Message).WithRecommendation("Run 'git tfs cleanup-workspaces' to remove the workspace.");
            }
            catch
            {
                workspace.Delete();
                throw;
            }
            return(workspace);
        }