Esempio n. 1
0
        private BranchModel GetBranchFromCurrentSolution(List <BranchModel> possibleBranches)
        {
            if (visualStudioEnvironmentProvider == null)
            {
                return(null);
            }

            var fileName = visualStudioEnvironmentProvider.Solution.FileName;

            if (String.IsNullOrWhiteSpace(fileName))
            {
                return(null);
            }

            var server    = tfsVersionControlProvider.GetCurrentServer();
            var workspace = server.TryGetWorkspace(fileName);

            if (workspace == null)
            {
                return(null);
            }

            var serverItemForLocalItem = workspace.GetServerItemForLocalItem(fileName);

            return(possibleBranches
                   .Where(x => serverItemForLocalItem.StartsWith(x.Path))
                   .OrderBy(x => x.CreatedDate)
                   .FirstOrDefault());
        }
Esempio n. 2
0
        private List <ChangesetModel> GetChangesets(string sourceBranch, string destinationBranch)
        {
            var server = versionControlProvider.GetCurrentServer();

            if (server == null || String.IsNullOrWhiteSpace(sourceBranch) || String.IsNullOrWhiteSpace(destinationBranch))
            {
                return(new List <ChangesetModel>());
            }

            var mergeCandidates = server.GetMergeCandidates(sourceBranch, destinationBranch, RecursionType.Full);

            return(mergeCandidates
                   .Select(x => new ChangesetModel
            {
                Id = String.Format("C{0}", x.Changeset.ChangesetId),
                AuthoredTime = x.Changeset.CreationDate,
                AuthorEmail = "*****@*****.**",
                AuthorName = x.Changeset.OwnerDisplayName,
                Comments = x.Changeset.Comment
            })
                   .ToList());
        }