예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChangeSourceControlRow"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="project">The project.</param>
        public ChangeSourceControlRow(IVisualGitServiceProvider context, GitProject project)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (project == null)
                throw new ArgumentNullException("project");

            _context = context;
            _project = project;
        }
예제 #2
0
        private async Task <OperationResult <GitRepository> > GetAgentGitRepositoryAsync(string workingDirectory)
        {
            var agentUrl = configuration.AgentRepositoryUrl;

            var gitProjectInformation =
                new GitProjectInformation(agentUrl, "", workingDirectory, Guid.NewGuid().ToString());
            var repository = new GitProject(gitProjectInformation, loggerFactory, shellRunner);

            var cloneResult = await repository.CloneAsync();

            if (!cloneResult.IsSuccessful)
            {
                return(OperationResult <GitRepository> .Failed($"Cannot clone agent repository. Error message: '{cloneResult.Error}'"));
            }

            return(OperationResult <GitRepository> .Success(cloneResult.Value));
        }
        private IEnumerable<GitItem> GetSingleProjectRoots(GitProject project)
        {
            SccProjectData pd;
            if (project.RawHandle == null || !_projectMap.TryGetValue(project.RawHandle, out pd))
                yield break;

            GitItem projectRootItem = null;
            if (!string.IsNullOrEmpty(pd.ProjectDirectory))
            {
                projectRootItem = StatusCache[pd.ProjectDirectory];

                if (projectRootItem.IsVersioned)
                    yield return projectRootItem;
            }

            string file = pd.ProjectFile;

            if (string.IsNullOrEmpty(file) || !GitItem.IsValidPath(file))
                yield break;

            GitItem projectFileItem = StatusCache[file];

            if (projectFileItem.IsVersioned &&
                (projectRootItem == null || !projectFileItem.IsBelowPath(projectRootItem.FullPath)))
            {
                yield return projectFileItem;
            }
        }
        public GitProject ResolveRawProject(GitProject project)
        {
            if (project == null)
                throw new ArgumentNullException("project");

            if (project.RawHandle == null && !project.IsSolution)
            {
                SccProjectFile file;

                if (_fileMap.TryGetValue(project.FullPath, out file))
                {
                    foreach (SccProjectData p in file.GetOwnerProjects())
                    {
                        return p.GitProject;
                    }
                }
            }

            return project;
        }
        public IEnumerable<GitItem> GetUpdateRoots(GitProject project)
        {
            if (project != null)
                return GetSingleProjectRoots(project);

            return GetSolutionProjectRoots();
        }
        public IGitProjectInfo GetProjectInfo(GitProject project)
        {
            if (project == null)
                return null;

            project = ResolveRawProject(project);

            if (project == null || project.RawHandle == null)
                return null;

            SccProjectData pd;
            if (_projectMap.TryGetValue(project.RawHandle, out pd))
            {
                return new WrapProjectInfo(pd);
            }

            return null;
        }
        public void SetProjectManaged(GitProject project, bool managed)
        {
            if (!IsActive)
                return; // Perhaps allow clearing management settings?

            if (project == null)
                SetProjectManagedRaw(null, managed);
            else
                SetProjectManagedRaw(project.RawHandle, managed);
        }
        public bool IsProjectManaged(GitProject project)
        {
            if (!IsActive)
                return false;

            if (project == null)
                return IsSolutionManaged;

            return IsProjectManagedRaw(project.RawHandle);
        }
 public void EnsureCheckOutReference(GitProject project)
 {
     // NOOP for today
 }
        // GET: /<controller>/
        //public IActionResult Projects()
        //{
        //    return View();
        //}

        //Method to display list of all projects
        public IActionResult GetProjects()
        {
            List <GitProject> projectList = GitProject.GetProjects();

            return(View(projectList));
        }
예제 #11
0
 /// <summary>
 /// [Implementation detail of Clone()]
 /// </summary>
 public ChangeSourceControlRow()
 {
     ChangeSourceControlRow from = _cloning.Pop();
     _context = from._context;
     _project = from._project;
 }