/// <summary> /// Parameterized class constructor /// </summary> /// <param name="diffView"></param> public DiffLineBackgroundRenderer(DiffView diffView) : this() { this._DiffView = diffView; }
public void DiffViewIsCorrect(FileSet set) { var basePatch = FourWayDiff.MakePatch(set.Previous, set.Previous); var classifiedPatches = FourWayDiff.ClassifyPatches( set.Previous, basePatch, set.Current, set.ReviewPatch ); var currentLines = LineList.SplitLines(set.Current); var previousLines = LineList.SplitLines(set.Previous); DiffView.AssignPatchesToLines(classifiedPatches, currentLines, previousLines); List <Line> cleared = new List <Line>(); DiffView.RemoveDiffsFromIdenticalLines(currentLines, previousLines, cleared); DumpLines(currentLines, previousLines); var previousIndex = 0; var currentIndex = 0; while (previousIndex < previousLines.Count && currentIndex < currentLines.Count) { void NextPrevious() { if (previousIndex < previousLines.Count) { previousIndex++; } } void NextCurrent() { if (currentIndex < currentLines.Count) { currentIndex++; } } var previousLine = previousLines[previousIndex]; var currentLine = currentLines[currentIndex]; if (!previousLine.IsNoChange) { NextPrevious(); } if (!currentLine.IsNoChange) { NextCurrent(); } if (previousLine.IsNoChange && currentLine.IsNoChange) { Assert.That(previousLine.Text, Is.EqualTo(currentLine.Text), () => { return($"Equal lines does not have the same text\nPrevious: {previousIndex,5} {previousLine}\nCurrent: {currentIndex,5} {currentLine}"); }); NextPrevious(); NextCurrent(); } } }
/// <summary> /// Parameterized constructor /// </summary> /// <param name="diffView"></param> public CustomLineNumberMargin(DiffView diffView) : this() { this._DiffView = diffView; }
private TestResult RunCommand(Commands cmd, bool test) { VersionControlItemList items = GetItems(); foreach (VersionControlItem it in items) { if (it.Repository == null) { if (cmd != Commands.Publish) { return(TestResult.NoVersionControl); } } else if (it.Repository.VersionControlSystem != null && !it.Repository.VersionControlSystem.IsInstalled) { return(TestResult.Disable); } } bool res = false; try { switch (cmd) { case Commands.Update: res = UpdateCommand.Update(items, test); break; case Commands.Diff: if (!test) { DiffView.Show(items); } else { res = DiffView.CanShow(items); } break; case Commands.Log: if (!test) { MonoDevelop.VersionControl.Views.LogView.Show(items, null); } else { res = MonoDevelop.VersionControl.Views.LogView.CanShow(items, null); } break; case Commands.Status: res = StatusView.Show(items, test); break; case Commands.Commit: res = CommitCommand.Commit(items, test); break; case Commands.Add: res = AddCommand.Add(items, test); break; case Commands.Remove: res = RemoveCommand.Remove(items, test); break; case Commands.Revert: res = RevertCommand.Revert(items, test); break; case Commands.Lock: res = LockCommand.Lock(items, test); break; case Commands.Unlock: res = UnlockCommand.Unlock(items, test); break; case Commands.Publish: VersionControlItem it = items [0]; if (items.Count == 1 && it.IsDirectory && it.WorkspaceObject != null) { res = PublishCommand.Publish(it.WorkspaceObject, it.Path, test); } break; case Commands.Annotate: res = BlameView.Show(items, test); break; case Commands.CreatePatch: res = CreatePatchCommand.CreatePatch(items, test); break; } } catch (Exception ex) { if (test) { LoggingService.LogError(ex.ToString()); } else { MessageService.ShowException(ex, GettextCatalog.GetString("Version control command failed.")); } return(TestResult.Disable); } return(res ? TestResult.Enable : TestResult.Disable); }
/// <summary> /// Class Constructor from editor and SolidColorBrush definition /// </summary> /// <param name="diffView"></param> public HighlightCurrentLineBackgroundRenderer(DiffView diffView) : this() { _Editor = diffView; }