private void DiffFiles_DataSourceChanged(object sender, EventArgs e)
 {
     if (DiffFiles.GitItemStatuses == null || !DiffFiles.GitItemStatuses.Any())
     {
         DiffText.ViewPatch(null);
     }
 }
        // Partly the same as RevisionDiffControl.cs ShowSelectedFileDiffAsync()
        private async Task ViewSelectedDiffAsync()
        {
            if (DiffFiles.SelectedItem == null || DiffFiles.Revision == null)
            {
                DiffText.Clear();
                return;
            }

            if (DiffFiles.SelectedItemParent?.Guid == GitRevision.CombinedDiffGuid)
            {
                var diffOfConflict = Module.GetCombinedDiffContent(DiffFiles.Revision, DiffFiles.SelectedItem.Name,
                                                                   DiffText.GetExtraDiffArguments(), DiffText.Encoding);

                if (string.IsNullOrWhiteSpace(diffOfConflict))
                {
                    diffOfConflict = Strings.UninterestingDiffOmitted;
                }

                DiffText.ViewPatch(text: diffOfConflict, openWithDifftool: null /* not implemented */);
                return;
            }

            await DiffText.ViewChangesAsync(DiffFiles.SelectedItemParent?.ObjectId, DiffFiles.Revision?.ObjectId, DiffFiles.SelectedItem, string.Empty,
                                            openWithDifftool : null /* use default */);
        }
        private async Task ShowSelectedFileDiffAsync()
        {
            if (DiffFiles.SelectedItem == null || DiffFiles.Revision == null)
            {
                DiffText.ViewPatch(null);
                return;
            }

            if (DiffFiles.SelectedItemParent?.Guid == DiffFiles.CombinedDiffGuid)
            {
                var diffOfConflict = Module.GetCombinedDiffContent(DiffFiles.Revision, DiffFiles.SelectedItem.Name,
                                                                   DiffText.GetExtraDiffArguments(), DiffText.Encoding);

                if (string.IsNullOrWhiteSpace(diffOfConflict))
                {
                    diffOfConflict = Strings.GetUninterestingDiffOmitted();
                }

                DiffText.ViewPatch(text: diffOfConflict, openWithDifftool: null /* not implemented */);
                return;
            }

            await DiffText.ViewChangesAsync(DiffFiles.SelectedItemParent?.Guid, DiffFiles.Revision?.Guid, DiffFiles.SelectedItem, string.Empty,
                                            openWithDifftool : () => firstToSelectedToolStripMenuItem.PerformClick());
        }
        private void ShowSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                DiffText.ViewPatch("");
                return;
            }

            var items = _revisionGrid.GetSelectedRevisions();

            if (items.Count() == 1)
            {
                items.Add(new GitRevision(Module, DiffFiles.SelectedItemParent));

                if (!string.IsNullOrWhiteSpace(DiffFiles.SelectedItemParent) &&
                    DiffFiles.SelectedItemParent == DiffFiles.CombinedDiff.Text)
                {
                    var diffOfConflict = Module.GetCombinedDiffContent(items.First(), DiffFiles.SelectedItem.Name,
                                                                       DiffText.GetExtraDiffArguments(), DiffText.Encoding);

                    if (string.IsNullOrWhiteSpace(diffOfConflict))
                    {
                        diffOfConflict = Strings.GetUninterestingDiffOmitted();
                    }

                    DiffText.ViewPatch(diffOfConflict);
                    return;
                }
            }
            DiffText.ViewChanges(items, DiffFiles.SelectedItem, String.Empty);
        }
Exemple #5
0
        private void ViewSelectedDiff()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (DiffFiles.SelectedItem != null)
            {
                Patch selectedPatch = Settings.Module.GetSingleDiff(Revision.Guid, Revision.Guid + "^", DiffFiles.SelectedItem.Name, DiffFiles.SelectedItem.OldName, DiffText.GetExtraDiffArguments());
                DiffText.ViewPatch(selectedPatch != null ? selectedPatch.Text : "");
            }
            Cursor.Current = Cursors.Default;
        }
Exemple #6
0
        private void ViewSelectedDiff()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (DiffFiles.SelectedItem != null)
            {
                Patch selectedPatch = GitCommandHelpers.GetSingleDiff(Revision.Guid, Revision.ParentGuids[0], DiffFiles.SelectedItem.Name, DiffFiles.SelectedItem.OldName, DiffText.GetExtraDiffArguments());
                DiffText.ViewPatch(selectedPatch != null ? selectedPatch.Text : "");
            }
            Cursor.Current = Cursors.Default;
        }
Exemple #7
0
        private void ShowSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                DiffText.ViewPatch("");
                return;
            }

            IList <GitRevision> items = new List <GitRevision> {
                _rightRevision, _leftRevision
            };

            if (items.Count() == 1)
            {
                items.Add(new GitRevision(Module, DiffFiles.SelectedItemParent));
            }
            DiffText.ViewChanges(items, DiffFiles.SelectedItem, String.Empty);
        }
Exemple #8
0
        private void ShowSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                DiffText.ViewPatch("");
                return;
            }
            var baseCommit = ckCompareToMergeBase.Checked ? _mergeBase : _baseRevision;

            IList <GitRevision> items = new List <GitRevision> {
                _headRevision, baseCommit
            };

            if (items.Count() == 1)
            {
                items.Add(new GitRevision(DiffFiles.SelectedItemParent));
            }
            DiffText.ViewChanges(items, DiffFiles.SelectedItem, String.Empty);
        }
Exemple #9
0
        private void ViewSelectedDiff()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (DiffFiles.SelectedItem != null)
            {
                if (_revision != null)
                {
                    DiffText.ViewChanges(_revision.Guid, DiffFiles.SelectedItemParent, DiffFiles.SelectedItem, String.Empty);
                }
                else if (_revisionGuid != null)
                {
                    Patch selectedPatch = Module.GetSingleDiff(_revisionGuid, _revisionGuid + "^",
                                                               DiffFiles.SelectedItem.Name, DiffFiles.SelectedItem.OldName,
                                                               DiffText.GetExtraDiffArguments(), DiffText.Encoding, true);
                    DiffText.ViewPatch(selectedPatch);
                }
            }
            Cursor.Current = Cursors.Default;
        }
        private void ShowSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                DiffText.ViewPatch(null);
                return;
            }

            var baseCommit = ckCompareToMergeBase.Checked ? _mergeBase : _baseRevision;

            var items = new List <GitRevision> {
                _headRevision, baseCommit
            };

            // TODO this can never be true
            if (items.Count == 1)
            {
                items.Add(DiffFiles.SelectedItemParent);
            }

            DiffText.ViewChangesAsync(items, DiffFiles.SelectedItem, string.Empty);
        }
Exemple #11
0
        private void ShowSelectedFileDiff()
        {
            if (DiffFiles.SelectedItem == null)
            {
                DiffText.ViewPatch(null);
                return;
            }

            var baseCommit = ckCompareToMergeBase.Checked ? _mergeBase : _baseRevision;

            var items = new List <GitRevision> {
                _headRevision, baseCommit
            };

            if (baseCommit == null)
            {
                // This should not happen
                items = new List <GitRevision> {
                    _headRevision, DiffFiles.SelectedItemParent
                };
            }

            DiffText.ViewChangesAsync(items, DiffFiles.SelectedItem, string.Empty);
        }
        private async Task ShowSelectedFileDiffAsync()
        {
            if (DiffFiles.SelectedItem == null || DiffFiles.Revision == null)
            {
                DiffText.ViewPatch("");
                return;
            }

            if (DiffFiles.SelectedItemParent?.Guid == DiffFiles.CombinedDiffGuid)
            {
                var diffOfConflict = Module.GetCombinedDiffContent(DiffFiles.Revision, DiffFiles.SelectedItem.Name,
                                                                   DiffText.GetExtraDiffArguments(), DiffText.Encoding);

                if (string.IsNullOrWhiteSpace(diffOfConflict))
                {
                    diffOfConflict = Strings.GetUninterestingDiffOmitted();
                }

                DiffText.ViewPatch(diffOfConflict);
                return;
            }

            await DiffText.ViewChangesAsync(DiffFiles.SelectedItemParent?.Guid, DiffFiles.Revision?.Guid, DiffFiles.SelectedItem, string.Empty);
        }