Пример #1
0
        public void ForceRefreshRevisions()
        {
            try
            {
                RevisionGraphDrawStyle = RevisionGraphDrawStyleEnum.DrawNonRelativesGray;
                IsMessageMultilineDataGridViewColumn.Visible = AppSettings.ShowIndicatorForMultilineMessage;

                ApplyFilterFromRevisionFilterDialog();

                _initialLoad = true;

                BuildServerWatcher.CancelBuildStatusFetchOperation();

                DisposeRevisionGraphCommand();

                var newCurrentCheckout = Module.GetCurrentCheckout();
                Task<SuperProjectInfo> newSuperPrjectInfo =
                    Task.Factory.StartNew(() => GetSuperprojectCheckout(ShowRemoteRef));
                newSuperPrjectInfo.ContinueWith((task) => Refresh(),
                    TaskScheduler.FromCurrentSynchronizationContext());
                //Only check for tracked files. This usually makes more sense and it performs a lot
                //better then checking for untracked files.
                // TODO: Check FiltredFileName
                Task<bool> unstagedChanges =
                    Task.Factory.StartNew(() => Module.GetUnstagedFiles().Any());
                Task<bool> stagedChanges =
                    Task.Factory.StartNew(() => Module.GetStagedFiles().Any());

                // If the current checkout changed, don't get the currently selected rows, select the
                // new current checkout instead.
                if (newCurrentCheckout == CurrentCheckout)
                {
                    LastSelectedRows = Revisions.SelectedIds;
                }
                else
                {
                    // This is a new checkout, so ensure the variable is cleared out.
                    LastSelectedRows = null;
                }

                Revisions.ClearSelection();
                CurrentCheckout = newCurrentCheckout;
                _filtredCurrentCheckout = null;
                _currentCheckoutParents = null;
                SuperprojectCurrentCheckout = newSuperPrjectInfo;
                UnstagedChanges = unstagedChanges;
                StagedChanges = stagedChanges;
                Revisions.Clear();
                Error.Visible = false;

                if (!Module.IsValidGitWorkingDir())
                {
                    Revisions.Visible = false;
                    NoCommits.Visible = true;
                    Loading.Visible = false;
                    NoGit.Visible = true;
                    string dir = Module.WorkingDir;
                    if (String.IsNullOrEmpty(dir) || !Directory.Exists(dir) ||
                        Directory.GetDirectories(dir).Length == 0 &&
                        Directory.GetFiles(dir).Length == 0)
                        CloneRepository.Show();
                    else
                        CloneRepository.Hide();
                    NoGit.BringToFront();
                    return;
                }

                NoCommits.Visible = false;
                NoGit.Visible = false;
                Revisions.Visible = true;
                Revisions.BringToFront();
                Revisions.Enabled = false;
                Loading.Visible = true;
                Loading.BringToFront();
                _isLoading = true;
                base.Refresh();

                IndexWatcher.Reset();

                if (!AppSettings.ShowGitNotes && (_refsOptions & (RefsFiltringOptions.All | RefsFiltringOptions.Boundary)) == (RefsFiltringOptions.All | RefsFiltringOptions.Boundary))
                    _refsOptions |= RefsFiltringOptions.ShowGitNotes;

                if (AppSettings.ShowGitNotes)
                    _refsOptions &= ~RefsFiltringOptions.ShowGitNotes;

                if (!AppSettings.ShowMergeCommits)
                    _refsOptions |= RefsFiltringOptions.NoMerges;

                RevisionGridInMemFilter revisionFilterIMF = RevisionGridInMemFilter.CreateIfNeeded(_revisionFilter.GetInMemAuthorFilter(),
                                                                                                   _revisionFilter.GetInMemCommitterFilter(),
                                                                                                   _revisionFilter.GetInMemMessageFilter(),
                                                                                                   _revisionFilter.GetIgnoreCase());
                RevisionGridInMemFilter filterBarIMF = RevisionGridInMemFilter.CreateIfNeeded(InMemAuthorFilter,
                                                                                              InMemCommitterFilter,
                                                                                              InMemMessageFilter,
                                                                                              InMemFilterIgnoreCase);
                RevisionGraphInMemFilter revGraphIMF;
                if (revisionFilterIMF != null && filterBarIMF != null)
                    revGraphIMF = new RevisionGraphInMemFilterOr(revisionFilterIMF, filterBarIMF);
                else if (revisionFilterIMF != null)
                    revGraphIMF = revisionFilterIMF;
                else
                    revGraphIMF = filterBarIMF;

                _revisionGraphCommand = new RevisionGraph(Module) {
                    BranchFilter = BranchFilter,
                    RefsOptions = _refsOptions,
                    RevisionFilter = _revisionFilter.GetRevisionFilter() + QuickRevisionFilter + FixedRevisionFilter,
                    PathFilter = _revisionFilter.GetPathFilter() + FixedPathFilter,
                };
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Error += _revisionGraphCommand_Error;
                _revisionGraphCommand.InMemFilter = revGraphIMF;
                _revisionGraphCommand.Execute();
                LoadRevisions();
                SetRevisionsLayout();
                ResetNavigationHistory();
            }
            catch (Exception)
            {
                Error.Visible = true;
                Error.BringToFront();
                throw;
            }
        }
Пример #2
0
        public void ForceRefreshRevisions()
        {
            try
            {
                RevisionGraphDrawStyle = RevisionGraphDrawStyleEnum.DrawNonRelativesGray;

                ApplyFilterFromRevisionFilterDialog();

                _initialLoad = true;

                DisposeRevisionGraphCommand();

                var newCurrentCheckout = Module.GetCurrentCheckout();
                Task<string[]> newSuperprojectCurrentCheckout =
                    Task.Factory.StartNew(() => GetSuperprojectCheckout());
                newSuperprojectCurrentCheckout.ContinueWith((task) => Refresh(),
                    TaskScheduler.FromCurrentSynchronizationContext());

                // If the current checkout changed, don't get the currently selected rows, select the
                // new current checkout instead.
                if (newCurrentCheckout == CurrentCheckout)
                {
                    LastSelectedRows = Revisions.SelectedIds;
                }
                else
                {
                    // This is a new checkout, so ensure the variable is cleared out.
                    LastSelectedRows = null;
                }

                Revisions.ClearSelection();
                CurrentCheckout = newCurrentCheckout;
                FiltredCurrentCheckout = CurrentCheckout;
                SuperprojectCurrentCheckout = newSuperprojectCurrentCheckout;
                Revisions.Clear();
                Error.Visible = false;

                if (!Module.IsValidGitWorkingDir())
                {
                    Revisions.Visible = false;
                    NoCommits.Visible = true;
                    Loading.Visible = false;
                    NoGit.Visible = true;
                    string dir = Module.WorkingDir;
                    if (String.IsNullOrEmpty(dir) || !Directory.Exists(dir) ||
                        Directory.GetDirectories(dir).Length == 0 &&
                        Directory.GetFiles(dir).Length == 0)
                        CloneRepository.Show();
                    else
                        CloneRepository.Hide();
                    NoGit.BringToFront();
                    return;
                }

                NoCommits.Visible = false;
                NoGit.Visible = false;
                Revisions.Visible = true;
                Revisions.BringToFront();
                Revisions.Enabled = false;
                Loading.Visible = true;
                Loading.BringToFront();
                _isLoading = true;
                base.Refresh();

                IndexWatcher.Reset();

                if (!AppSettings.ShowGitNotes && (_refsOptions & (RefsFiltringOptions.All | RefsFiltringOptions.Boundary)) == (RefsFiltringOptions.All | RefsFiltringOptions.Boundary))
                    _refsOptions |= RefsFiltringOptions.ShowGitNotes;

                if (AppSettings.ShowGitNotes)
                    _refsOptions &= ~RefsFiltringOptions.ShowGitNotes;

                if (!AppSettings.ShowMergeCommits)
                    _refsOptions |= RefsFiltringOptions.NoMerges;

                RevisionGridInMemFilter revisionFilterIMF = RevisionGridInMemFilter.CreateIfNeeded(_revisionFilter.GetInMemAuthorFilter(),
                                                                                                   _revisionFilter.GetInMemCommitterFilter(),
                                                                                                   _revisionFilter.GetInMemMessageFilter(),
                                                                                                   _revisionFilter.GetIgnoreCase());
                RevisionGridInMemFilter filterBarIMF = RevisionGridInMemFilter.CreateIfNeeded(InMemAuthorFilter,
                                                                                              InMemCommitterFilter,
                                                                                              InMemMessageFilter,
                                                                                              InMemFilterIgnoreCase);
                RevisionGraphInMemFilter revGraphIMF;
                if (revisionFilterIMF != null && filterBarIMF != null)
                    revGraphIMF = new RevisionGraphInMemFilterOr(revisionFilterIMF, filterBarIMF);
                else if (revisionFilterIMF != null)
                    revGraphIMF = revisionFilterIMF;
                else
                    revGraphIMF = filterBarIMF;

                _revisionGraphCommand = new RevisionGraph(Module) { BranchFilter = BranchFilter, RefsOptions = _refsOptions, Filter = _revisionFilter.GetFilter() + Filter + FixedFilter };
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Error += _revisionGraphCommand_Error;
                _revisionGraphCommand.InMemFilter = revGraphIMF;
                _revisionGraphCommand.Execute();
                LoadRevisions();
                SetRevisionsLayout();
            }
            catch (Exception)
            {
                Error.Visible = true;
                Error.BringToFront();
                throw;
            }
        }
Пример #3
0
        private void SetShowBranches()
        {
            _showAllBranchesToolStripMenuItemChecked = !AppSettings.BranchFilterEnabled;
            _showCurrentBranchOnlyToolStripMenuItemChecked =
                AppSettings.BranchFilterEnabled && AppSettings.ShowCurrentBranchOnly;
            _showFilteredBranchesToolStripMenuItemChecked =
                AppSettings.BranchFilterEnabled && !AppSettings.ShowCurrentBranchOnly;

            BranchFilter = _revisionFilter.GetBranchFilter();

            if (!AppSettings.BranchFilterEnabled)
                _refsOptions = RefsFiltringOptions.All | RefsFiltringOptions.Boundary;
            else if (AppSettings.ShowCurrentBranchOnly)
                _refsOptions = 0;
            else
                _refsOptions = BranchFilter.Length > 0
                               ? 0
                               : RefsFiltringOptions.All | RefsFiltringOptions.Boundary;

            _revisionGridMenuCommands.TriggerMenuChanged(); // apply checkboxes changes also to FormBrowse main menu
        }
Пример #4
0
        private void SetShowBranches()
        {
            showAllBranchesToolStripMenuItem.Checked = !Settings.BranchFilterEnabled;
            showCurrentBranchOnlyToolStripMenuItem.Checked =
                Settings.BranchFilterEnabled && Settings.ShowCurrentBranchOnly;
            showFilteredBranchesToolStripMenuItem.Checked =
                Settings.BranchFilterEnabled && !Settings.ShowCurrentBranchOnly;

            BranchFilter = _revisionFilter.GetBranchFilter();

            if (!Settings.BranchFilterEnabled)
                _refsOptions = RefsFiltringOptions.All | RefsFiltringOptions.Boundary;
            else if (Settings.ShowCurrentBranchOnly)
                _refsOptions = 0;
            else
                _refsOptions = BranchFilter.Length > 0
                               ? 0
                               : RefsFiltringOptions.All | RefsFiltringOptions.Boundary;
        }