private async Task ShowSelectedFileDiffAsync()
        {
            if (DiffFiles.SelectedItem == null || DiffFiles.Revision == null)
            {
                DiffText.ViewPatch(null);
                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 : () => firstToSelectedToolStripMenuItem.PerformClick());
        }
Ejemplo n.º 2
0
        // Partly the same as RevisionDiffControl.cs ShowSelectedFileDiffAsync()
        private async Task ViewSelectedDiffAsync()
        {
            if (DiffFiles.SelectedItem == null || DiffFiles.Revision == null)
            {
                DiffText.Clear();
                return;
            }

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

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

                DiffText.ViewPatch(DiffFiles.SelectedItem.Name,
                                   text: diffOfConflict,
                                   openWithDifftool: null,
                                   isText: DiffFiles.SelectedItem.IsSubmodule);

                return;
            }

            await DiffText.ViewChangesAsync(DiffFiles.SelectedItemParent?.ObjectId, DiffFiles.Revision?.ObjectId, DiffFiles.SelectedItem, string.Empty,
                                            openWithDifftool : null /* use default */);
        }
Ejemplo n.º 3
0
        private async Task ShowSelectedFileDiff()
        {
            var items = _revisionGrid.GetSelectedRevisions();

            if (DiffFiles.SelectedItem == null || items.Count() == 0)
            {
                DiffText.ViewPatch("");
                return;
            }

            if (items.Count() == 1)
            {
                items.Add(DiffFiles.SelectedItemParent);

                if (!string.IsNullOrWhiteSpace(DiffFiles.SelectedItemParent?.Guid) &&
                    DiffFiles.SelectedItemParent?.Guid == 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;
                }
            }

            await DiffText.ViewChanges(items, DiffFiles.SelectedItem, String.Empty);
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
        }