Execute() public method

public Execute ( ) : void
return void
Esempio n. 1
0
        private void InternalRefresh()
        {
            Error.Visible = false;
            NoCommits.Visible = false;
            NoGit.Visible = false;
            Revisions.Visible = true;

            if (!GitCommands.Settings.ValidWorkingDir())
            {
                Revisions.RowCount = 0;
                Revisions.ScrollBars = ScrollBars.None;
                Revisions.Visible = false;

                NoCommits.Visible = true;
                NoGit.Visible = true;
                Loading.Visible = false;
                return;
            }

            int numberOfVisibleRows = Revisions.DisplayedRowCount(true) + 1;
            int firstVisibleRow = Revisions.FirstDisplayedScrollingRowIndex;

            if (numberOfVisibleRows < 1)
                numberOfVisibleRows = 20;

            if (LastRevision >= Math.Min(Revisions.RowCount, firstVisibleRow + numberOfVisibleRows))
            {
                return;
            }

            LastRevision = Math.Min(Revisions.RowCount, Math.Max(LastScrollPos + numberOfVisibleRows, Math.Max(firstVisibleRow + numberOfVisibleRows, Math.Max(GitCommands.Settings.MaxCommits, LastRevision * 2))));

            Revisions.Enabled = false;
            Loading.Visible = true;
            indexWatcher.Reset();
            revisionGraphCommand = new RevisionGraph();

            revisionGraphCommand.LogParam = LogParam + Filter;
            revisionGraphCommand.Exited += new EventHandler(gitGetCommitsCommand_Exited);
            revisionGraphCommand.LimitRevisions = LastRevision;
            revisionGraphCommand.Execute();
        }
Esempio n. 2
0
        public void ForceRefreshRevisions()
        {
            try
            {
                RevisionGraphDrawStyle = DvcsGraph.RevisionGraphDrawStyleEnum.DrawNonRelativesGray;

                ApplyFilterFromRevisionFilterDialog();

                _initialLoad = true;

                LastScrollPos = Revisions.FirstDisplayedScrollingRowIndex;

                DisposeRevisionGraphCommand();

                var newCurrentCheckout = Module.GetCurrentCheckout();
                var newSuperprojectCurrentCheckout = Module.GetSuperprojectCurrentCheckout();

                // 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;
                SuperprojectCurrentCheckout = newSuperprojectCurrentCheckout;
                Revisions.Clear();
                Error.Visible = false;

                if (!Module.ValidWorkingDir())
                {
                    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 (!Settings.ShowGitNotes && !LogParam.Contains(" --not --glob=notes --not"))
                    LogParam = LogParam + " --not --glob=notes --not";

                if (Settings.ShowGitNotes && LogParam.Contains(" --not --glob=notes --not"))
                    LogParam = LogParam.Replace("  --not --glob=notes --not", string.Empty);

                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, LogParam = LogParam + _revisionFilter.GetFilter() + Filter + FixedFilter };
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Error += _revisionGraphCommand_Error;
                _revisionGraphCommand.InMemFilter = revGraphIMF;
                //_revisionGraphCommand.BeginUpdate += ((s, e) => Revisions.Invoke((Action) (() => Revisions.Clear())));
                _revisionGraphCommand.Execute();
                LoadRevisions();
                SetRevisionsLayout();
            }
            catch (Exception exception)
            {
                Error.Visible = true;
                Error.BringToFront();
                MessageBox.Show(this, exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        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;
            }
        }
Esempio n. 4
0
        public void ForceRefreshRevisions()
        {
            try
            {
                _initialLoad = true;

                LastScrollPos = Revisions.FirstDisplayedScrollingRowIndex;

                //Hide graph column when there it is disabled OR when a filter is active
                //allowing for special case when history of a single file is being displayed
                if (!Settings.ShowRevisionGraph || (FilterIsApplied(false) && !AllowGraphWithFilter))
                {
                    Revisions.ShowHideRevisionGraph(false);
                }
                else
                {
                    Revisions.ShowHideRevisionGraph(true);
                }

                DisposeRevisionGraphCommand();

                var newCurrentCheckout = GitCommandHelpers.GetCurrentCheckout();

                // If the current checkout changed, don't get the currently selected rows, select the
                // new current checkout instead.
                if (newCurrentCheckout == CurrentCheckout)
                {
                    LastSelectedRows = Revisions.SelectedIds;
                }

                Revisions.ClearSelection();

                CurrentCheckout = newCurrentCheckout;
                Error.Visible = false;
                NoCommits.Visible = false;
                NoGit.Visible = false;
                Revisions.Visible = true;
                Loading.Visible = true;

                Revisions.Clear();

                if (!Settings.ValidWorkingDir())
                {
                    Revisions.Visible = false;

                    NoCommits.Visible = false;
                    NoGit.Visible = true;
                    Loading.Visible = false;
                    return;
                }

                Revisions.Enabled = false;
                Loading.Visible = true;
                _indexWatcher.Reset();
                _revisionGraphCommand = new RevisionGraph { BranchFilter = BranchFilter, LogParam = LogParam + Filter };
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Error += _revisionGraphCommand_Error;
                if (!(string.IsNullOrEmpty(InMemAuthorFilter) &&
                      string.IsNullOrEmpty(InMemCommitterFilter) &&
                      string.IsNullOrEmpty(InMemMessageFilter)))
                    _revisionGraphCommand.InMemFilter = new RevisionGridInMemFilter(InMemAuthorFilter,
                                                                                    InMemCommitterFilter,
                                                                                    InMemMessageFilter,
                                                                                    InMemFilterIgnoreCase);

                _revisionGraphCommand.Execute();

                LoadRevisions();
            }
            catch (Exception exception)
            {
                Error.Visible = true;
                MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        public void ForceRefreshRevisions()
        {
            try
            {
                _initialLoad = true;

                LastScrollPos = Revisions.FirstDisplayedScrollingRowIndex;

                //Hide graph column when there it is disabled OR when a filter is active
                if (!Settings.ShowRevisionGraph || !string.IsNullOrEmpty(Filter))
                {
                    Revisions.ShowHideRevisionGraph(false);
                }
                else
                {
                    Revisions.ShowHideRevisionGraph(true);
                }

                if (_revisionGraphCommand != null)
                {
                    _revisionGraphCommand.Kill();
                }

                var newCurrentCheckout = GitCommands.GitCommands.GetCurrentCheckout();

                // If the current checkout changed, don't get the currently selected rows, select the
                // new current checkout instead.
                if (newCurrentCheckout == CurrentCheckout)
                {
                    LastSelectedRows = Revisions.SelectedIds;
                }
                Revisions.ClearSelection();

                CurrentCheckout = newCurrentCheckout;
                Error.Visible = false;
                NoCommits.Visible = false;
                NoGit.Visible = false;
                Revisions.Visible = true;
                Loading.Visible = true;

                Revisions.Clear();

                if (!Settings.ValidWorkingDir())
                {
                    Revisions.Visible = false;

                    NoCommits.Visible = false;
                    NoGit.Visible = true;
                    Loading.Visible = false;
                    return;
                }

                Revisions.Enabled = false;
                Loading.Visible = true;
                _indexWatcher.Reset();
                _revisionGraphCommand = new RevisionGraph {BranchFilter = BranchFilter, LogParam = LogParam + Filter};
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Execute();

                LoadRevisions();
            }
            catch (Exception exception)
            {
                Error.Visible = true;
                MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
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;
            }
        }
Esempio n. 7
0
        public void ForceRefreshRevisions()
        {
            try
            {
                ApplyFilterFromRevisionFilterDialog();

                _initialLoad = true;

                LastScrollPos = Revisions.FirstDisplayedScrollingRowIndex;

                DisposeRevisionGraphCommand();

                var newCurrentCheckout = GitCommandHelpers.GetCurrentCheckout();

                // If the current checkout changed, don't get the currently selected rows, select the
                // new current checkout instead.
                if (newCurrentCheckout == CurrentCheckout)
                {
                    LastSelectedRows = Revisions.SelectedIds;
                }

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

                if (!Settings.ValidWorkingDir())
                {
                    Revisions.Visible = false;
                    NoCommits.Visible = true;
                    Loading.Visible = false;
                    NoGit.Visible = true;
                    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 (!Settings.ShowGitNotes && !LogParam.Contains(" --not --glob=notes --not"))
                    LogParam = LogParam + " --not --glob=notes --not";

                if (Settings.ShowGitNotes && LogParam.Contains(" --not --glob=notes --not"))
                    LogParam = LogParam.Replace("  --not --glob=notes --not", string.Empty);

                _revisionGraphCommand = new RevisionGraph { BranchFilter = BranchFilter, LogParam = LogParam + Filter + _revisionFilter.GetFilter() };
                _revisionGraphCommand.Updated += GitGetCommitsCommandUpdated;
                _revisionGraphCommand.Exited += GitGetCommitsCommandExited;
                _revisionGraphCommand.Error += _revisionGraphCommand_Error;
                //_revisionGraphCommand.BeginUpdate += ((s, e) => Revisions.Invoke((Action) (() => Revisions.Clear())));

                if (!(string.IsNullOrEmpty(InMemAuthorFilter) &&
                      string.IsNullOrEmpty(InMemCommitterFilter) &&
                      string.IsNullOrEmpty(InMemMessageFilter)))
                    _revisionGraphCommand.InMemFilter = new RevisionGridInMemFilter(InMemAuthorFilter,
                                                                                    InMemCommitterFilter,
                                                                                    InMemMessageFilter,
                                                                                    InMemFilterIgnoreCase);

                _revisionGraphCommand.Execute();
                LoadRevisions();
                SetRevisionsLayout();
            }
            catch (Exception exception)
            {
                Error.Visible = true;
                Error.BringToFront();
                MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
        public void RevisionGrid_Form1()
        {
            app = new ApplicationContext();

            Form = new FormRevisionGrid();
            RevisionGrid = Form.Grid;
            Revisions = RevisionGrid.RevisionsGraph;

            app.MainForm = Form;

            var currentDir = Directory.GetCurrentDirectory();
            string[] args = new string[] { "", "", currentDir };    // GitExtensionsTest\bin\Debug
            if (args[2].EndsWith(@"bin\Debug"))
                args[2] = Path.GetFullPath(currentDir + @"\..\..\..");

            var dir = GetWorkingDir(args);
            Directory.SetCurrentDirectory(dir);

            GitUICommands uCommands = new GitUICommands(dir);
            var browseForm = TestStatic.StartBrowseForm(uCommands, Form);

            Form.LoadModule(browseForm.Module);
            RevisionGrid.UICommandsSource = Form;

            var _revisionGraphCommand = new RevisionGraph(browseForm.Module)
            {
                BranchFilter = null
            };
            _revisionGraphCommand.Updated += _revisionGraphCommand_Updated;
            _revisionGraphCommand.Error += _revisionGraphCommand_Error;
            //_revisionGraphCommand.InMemFilter = revGraphIMF;

            _revisionGraphCommand.Exited += _revisionGraphCommand_Exited;

            RevisionGrid.RevisionsGraph.Columns[1].Visible = false;
            RevisionGrid.RevisionsGraph.RemovePainting();

            Form.Show();

            _revisionGraphCommand.Execute();

            Application.Run(app);
        }