Exemplo n.º 1
0
        public string GetTabText()
        {
            var revisions = _revisionGrid.GetSelectedRevisions();

            DiffText.SaveCurrentScrollPos();
            DiffFiles.SetDiffs(revisions);
            if (_oldDiffItem != null && revisions.Count > 0 && revisions[0].Guid == _oldRevision)
            {
                DiffFiles.SelectedItem = _oldDiffItem;
                _oldDiffItem           = null;
                _oldRevision           = null;
            }

            switch (revisions.Count)
            {
            case 0:
                return(_diffNoSelection.Text);

            case 1:     // diff "parent" --> "selected revision"
                return(_diffParentWithSelection.Text);

            case 2:     // diff "first clicked revision" --> "second clicked revision"
                return(_diffTwoSelected.Text);
            }
            return(_diffNotSupported.Text);
        }
Exemplo n.º 2
0
 private void RevisionGridSelectionChanged(object sender, EventArgs e)
 {
     Cursor.Current            = Cursors.WaitCursor;
     DiffFiles.GitItemStatuses = null;
     DiffFiles.SetDiffs(RevisionGrid.GetSelectedRevisions());
     Cursor.Current = Cursors.Default;
 }
Exemplo n.º 3
0
 private void RevisionGridSelectionChanged(object sender, EventArgs e)
 {
     using (WaitCursorScope.Enter())
     {
         DiffFiles.SetDiffs(RevisionGrid.GetSelectedRevisions());
     }
 }
Exemplo n.º 4
0
 public CommitDiff()
 {
     InitializeComponent();
     Translate();
     DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
     DiffFiles.Focus();
     DiffFiles.SetDiffs();
 }
Exemplo n.º 5
0
        public void RefreshArtificial()
        {
            var revisions = _revisionGrid.GetSelectedRevisions();

            if (revisions.Count > 0 && revisions[0].IsArtificial())
            {
                DiffFiles.SetDiffs(revisions);
            }
        }
Exemplo n.º 6
0
        private void PopulateDiffFiles()
        {
            lblBaseCommit.Text = _baseCommitDisplayStr;
            lblHeadCommit.Text = _headCommitDisplayStr;

            DiffFiles.SetDiffs(ckCompareToMergeBase.Checked
                ? new[] { _headRevision, _mergeBase }
                : new[] { _headRevision, _baseRevision });
        }
Exemplo n.º 7
0
 private FormCommitDiff(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
     DiffFiles.Focus();
     DiffFiles.SetDiffs();
 }
Exemplo n.º 8
0
        public void DisplayDiffTab()
        {
            var revisions = _revisionGrid.GetSelectedRevisions();

            DiffFiles.SetDiffs(revisions);
            if (_oldDiffItem != null && DiffFiles.Revision?.Guid == _oldRevision)
            {
                DiffFiles.SelectedItem = _oldDiffItem;
                _oldDiffItem           = null;
                _oldRevision           = null;
            }
        }
Exemplo n.º 9
0
        public CommitDiff()
        {
            InitializeComponent();
            InitializeComplete();

            DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
            DiffFiles.Focus();
            DiffFiles.SetDiffs();

            splitContainer1.SplitterDistance = DpiUtil.Scale(200);
            splitContainer2.SplitterDistance = DpiUtil.Scale(260);
        }
Exemplo n.º 10
0
        private void SetDiffs(IReadOnlyList <GitRevision> revisions)
        {
            GitItemStatus oldDiffItem = DiffFiles.SelectedItem;

            DiffFiles.SetDiffs(revisions, _revisionGrid.GetRevision);

            // Try to restore previous item
            if (oldDiffItem != null && DiffFiles.GitItemStatuses.Any(i => i.Name.Equals(oldDiffItem.Name)))
            {
                DiffFiles.SelectedItem = oldDiffItem;
            }
        }
Exemplo n.º 11
0
        private void SetDiffs(IReadOnlyList <GitRevision> revisions)
        {
            var item        = DiffFiles.SelectedItem;
            var oldDiffItem = DiffFiles.FirstGroupItems.Contains(item) ? item : null;

            DiffFiles.SetDiffs(revisions, _revisionGrid.GetRevision);

            // Try to restore previous item
            if (oldDiffItem != null && DiffFiles.FirstGroupItems.Any(i => i.Name.Equals(oldDiffItem.Name)))
            {
                DiffFiles.SelectedItem = oldDiffItem;
            }
        }
Exemplo n.º 12
0
        public FormCommitDiff(GitUICommands aCommands, string revisionGuid)
            : this(aCommands)
        {
            // We cannot use the GitRevision from revision grid. When a filtered commit list
            // is shown (file history/normal filter) the parent guids are not the 'real' parents,
            // but the parents in the filtered list.
            GitRevision revision = Module.GetRevision(revisionGuid);

            if (revision != null)
            {
                DiffFiles.SetDiffs(revision);

                Text = "Diff - " + GitRevision.ToShortSha(revision.Guid) + " - " + revision.AuthorDate + " - " + revision.Author + " - " + Module.WorkingDir;;
            }
        }
Exemplo n.º 13
0
        private void PopulateDiffFiles()
        {
            lblBaseCommit.Text = _baseCommitDisplayStr;
            lblHeadCommit.Text = _headCommitDisplayStr;

            DiffFiles.SetDiffs(ckCompareToMergeBase.Checked
                ? new[] { _headRevision, _mergeBase }
                : new[] { _headRevision, _baseRevision });

            // Bug in git-for-windows: Comparing working directory to any branch, fails, due to -R
            // I.e., git difftool --gui --no-prompt --dir-diff -R HEAD fails, but
            // git difftool --gui --no-prompt --dir-diff HEAD succeeds
            // Thus, we disable comparing "from" working directory.
            var enableDifftoolDirDiff = _baseRevision?.Guid != GitRevision.WorkTreeGuid;

            btnCompareDirectoriesWithDiffTool.Enabled = enableDifftoolDirDiff;
        }
Exemplo n.º 14
0
        private void PopulateDiffFiles()
        {
            lblBaseCommit.Text = _baseCommitDisplayStr;
            lblHeadCommit.Text = _headCommitDisplayStr;

            if (ckCompareToMergeBase.Checked)
            {
                DiffFiles.SetDiffs(new List <GitRevision> {
                    _headRevision, _mergeBase
                });
            }
            else
            {
                DiffFiles.SetDiffs(new List <GitRevision> {
                    _headRevision, _baseRevision
                });
            }
        }
Exemplo n.º 15
0
        private void PopulateDiffFiles()
        {
            lblLeftCommit.Text  = _leftDisplayStr;
            lblRightCommit.Text = _rightDisplayStr;

            if (ckCompareToMergeBase.Checked)
            {
                DiffFiles.SetDiffs(new List <GitRevision> {
                    _rightRevision, _mergeBase
                });
            }
            else
            {
                DiffFiles.SetDiffs(new List <GitRevision> {
                    _rightRevision, _leftRevision
                });
            }
        }
Exemplo n.º 16
0
        public void SetRevision([CanBeNull] ObjectId objectId, [CanBeNull] string fileToSelect)
        {
            // We cannot use the GitRevision from revision grid. When a filtered commit list
            // is shown (file history/normal filter) the parent guids are not the 'real' parents,
            // but the parents in the filtered list.
            GitRevision revision = Module.GetRevision(objectId);

            if (revision != null)
            {
                DiffFiles.SetDiffs(new[] { revision });
                if (fileToSelect != null)
                {
                    var itemToSelect = DiffFiles.AllItems.FirstOrDefault(i => i.Name == fileToSelect);
                    if (itemToSelect != null)
                    {
                        DiffFiles.SelectedItem = itemToSelect;
                    }
                }

                commitInfo.Revision = revision;

                Text = "Diff - " + revision.ObjectId.ToShortString() + " - " + revision.AuthorDate + " - " + revision.Author + " - " + Module.WorkingDir;
            }
        }