@Test public void testComputeChangeScopeOfCliGitDiffOutput_nonExistingChanges() throws SourceControlException { mockStatic(GitDiffRunner.class); Diff diff = getChangeScopeResolverDiff(); when(GitDiffRunner.diff(any(), any())).thenReturn(singletonList(diff)); RevisionScope<ObjectId> scope = revisionResolver.resolve(DiffConstants.LATEST_COMMIT, DiffConstants.LOCAL_CHANGES_NOT_COMMITTED); ChangeScope<Change> changeScope = changeScopeResolver.getChangeScope(scope); String fileName = "com/sandboni/core/scm/resolvers/SomeNonExistingChangeScopeResolver.java"; assertNotNull(changeScope); List<Change> changes = changeScope.getChanges(fileName); assertNull(changes); }
@Override public ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope) throws SourceControlException { final ChangeScope<Change> scope = new ChangeScopeImpl(); List<Diff> diffs = GitDiffRunner.diff(repository, revisionScope); ObjectId toRevision = revisionScope.getTo(); diffs.forEach(throwingConsumerWrapper(d -> getChangesForDiff(d, scope, toRevision))); return scope; }
CliChangeScopeResolver extends JGitChangeScopeResolver implements ChangeScopeResolver { @Override public ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope) throws SourceControlException { final ChangeScope<Change> scope = new ChangeScopeImpl(); List<Diff> diffs = GitDiffRunner.diff(repository, revisionScope); ObjectId toRevision = revisionScope.getTo(); diffs.forEach(throwingConsumerWrapper(d -> getChangesForDiff(d, scope, toRevision))); return scope; } }
CliChangeScopeResolver extends JGitChangeScopeResolver implements ChangeScopeResolver { @Override public ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope) throws SourceControlException { final ChangeScope<Change> scope = new ChangeScopeImpl(); List<Diff> diffs = GitDiffRunner.diff(repository, revisionScope); ObjectId toRevision = revisionScope.getTo(); diffs.forEach(throwingConsumerWrapper(d -> getChangesForDiff(d, scope, toRevision))); return scope; } CliChangeScopeResolver(Repository repository, SourceControlFilter... filters); }
CliChangeScopeResolver extends JGitChangeScopeResolver implements ChangeScopeResolver { @Override public ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope) throws SourceControlException { final ChangeScope<Change> scope = new ChangeScopeImpl(); List<Diff> diffs = GitDiffRunner.diff(repository, revisionScope); ObjectId toRevision = revisionScope.getTo(); diffs.forEach(throwingConsumerWrapper(d -> getChangesForDiff(d, scope, toRevision))); return scope; } CliChangeScopeResolver(Repository repository, SourceControlFilter... filters); @Override ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope); }
CliChangeScopeResolver extends JGitChangeScopeResolver implements ChangeScopeResolver { @Override public ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope) throws SourceControlException { final ChangeScope<Change> scope = new ChangeScopeImpl(); List<Diff> diffs = GitDiffRunner.diff(repository, revisionScope); ObjectId toRevision = revisionScope.getTo(); diffs.forEach(throwingConsumerWrapper(d -> getChangesForDiff(d, scope, toRevision))); return scope; } CliChangeScopeResolver(Repository repository, SourceControlFilter... filters); @Override ChangeScope<Change> getChangeScope(RevisionScope<ObjectId> revisionScope);  }