예제 #1
0
        public BranchTeamService(TfsTeamProjectCollection tfs, ITeamExplorer teamExplorer)
        {
            var versionControlServer = tfs.GetService <VersionControlServer>();

            _workspace        = WorkspaceHelper.GetWorkspace(versionControlServer, WorkspaceHelper.GetWorkspaces(versionControlServer, tfs));
            _teamExplorer     = teamExplorer;
            _changesetService = new ChangesetService(versionControlServer);
        }
예제 #2
0
        protected ChangesetViewModel ToChangesetViewModel(Changeset tfsChangeset, ChangesetService changesetService)
        {
            var changesetViewModel = new ChangesetViewModel
            {
                ChangesetId = tfsChangeset.ChangesetId,
                Comment     = tfsChangeset.Comment,
                Branches    = changesetService.GetAssociatedBranches(tfsChangeset.ChangesetId)
                              .Select(i => i.Item)
                              .ToList()
            };

            return(changesetViewModel);
        }
예제 #3
0
        protected ChangesetViewModel ToChangesetViewModel(Changeset tfsChangeset, ChangesetService changesetService)
        {
            var changesetViewModel = new ChangesetViewModel
            {
                ChangesetId = tfsChangeset.ChangesetId,
                Comment = tfsChangeset.Comment,
                Branches = changesetService.GetAssociatedBranches(tfsChangeset.ChangesetId)
                    .Select(i => i.Item)
                    .ToList()
            };

            return changesetViewModel;
        }
예제 #4
0
        protected ChangesetViewModel ToChangesetViewModel(Changeset tfsChangeset, ChangesetService changesetService)
        {
            var branches = changesetService.GetAssociatedBranches(tfsChangeset.ChangesetId)
                .Select(i => i.Item)
                .ToList();
            var changesetViewModel = new ChangesetViewModel
            {
                ChangesetId = tfsChangeset.ChangesetId,
                Comment = tfsChangeset.Comment,
                Branches = branches,
                DisplayBranchName = BranchHelper.GetDisplayBranchName(branches, _settings.BranchNameMatches)
            };

            return changesetViewModel;
        }
예제 #5
0
        protected ChangesetViewModel ToChangesetViewModel(Changeset tfsChangeset, ChangesetService changesetService)
        {
            var changesetViewModel = new ChangesetViewModel
            {
                ChangesetId     = tfsChangeset.ChangesetId,
                Comment         = tfsChangeset.Comment,
                ChangeDate      = tfsChangeset.CreationDate.ToString("yyyy-MM-dd"),
                Username        = tfsChangeset.Committer,
                UserDisplayName = tfsChangeset.CommitterDisplayName,
                Branches        = changesetService.GetAssociatedBranches(tfsChangeset.ChangesetId)
                                  .Select(i => i.Item)
                                  .ToList()
            };

            return(changesetViewModel);
        }
예제 #6
0
        protected async override Task InitializeAsync(object sender, SectionInitializeEventArgs e)
        {
            Logger.Debug("Start initilize branches section");

            var tfs = Context.TeamProjectCollection;
            var versionControl = tfs.GetService<VersionControlServer>();
            SubscribeWorkspaceChanges(versionControl);

            _changesetService = new ChangesetService(versionControl);

            _eventAggregator.GetEvent<SelectChangesetEvent>()
                .Subscribe(OnSelectedChangeset);
            _eventAggregator.GetEvent<BranchSelectedChangedEvent>()
                .Subscribe(OnBranchSelectedChanged);

            if (e.Context == null)
            {
                Workspaces =
                    new ObservableCollection<Workspace>(versionControl.QueryWorkspaces(null,
                        tfs.AuthorizedIdentity.UniqueName, Environment.MachineName));
                if (Workspaces.Count > 0)
                {
                    Workspace = WorkspaceHelper.GetWorkspace(versionControl, Workspaces);
                    ShowWorkspaceChooser = Workspaces.Count > 1;
                }
                else
                {
                    Workspace = null;
                }

                MergeModes = new ObservableCollection<MergeMode>
                {
                    MergeMode.Merge,
                    MergeMode.MergeAndCheckIn
                };
                MergeMode = _settings.LastMergeOperation;

                await RefreshAsync();
            }
            else
            {
                RestoreContext(e);
            }

            Logger.Debug("End initialize branches section");
        }